home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 June / Software of the Month Club 1996 June.iso / mac / Business / Extended Calculator II / Extended Calculator Manual < prev    next >
Text File  |  1996-02-22  |  118KB  |  3,074 lines

  1.  
  2.  
  3.          ABOUT EXTENDED CALCULATOR II
  4.  
  5. This document contains important information about the Extended Calculator II, please read it carefully. The document is intended for reading with the program Document Reader. It can be read by other applications as well, but then you will not be able to take advantage of Document Reader's unique navigating capabilities.
  6.  
  7. This document should ALWAYS be distributed together with the Extended Calculator II.
  8.  
  9. 1. General Instructions
  10.  
  11. 1.1. About this program
  12.  
  13. The Extended Calculator II was written by Niklas Frykholm using THINK C and CodeWarrior. The program is based on Extended Calculator, also by Niklas Frykholm, but has been rewritten almost entirely to be given more power and flexibility.
  14.  
  15. This program is ShareWare, so feel free to copy it and give it to your friends. However, if you use it and enjoy it you have to pay a small registration fee.
  16.  
  17. From now and on this program, and all my other programs are distributed as the Niklas Frykholm ShareWare package. By paying  at least $5 you will be entitled to use, not only this program, but every ShareWare program that I have ever written, and that I will ever write in the future. This includes MacSnails, MacPatience, DocumentReader, CreatorChanger, BattleTanks, Extended Calculator II, Electric Poet, SimpleCard, HTML Pro, OrgaNicer, etc.
  18.  
  19. Note that $5 will only buy you a nominal registration. If you want a disk with the latest version of the package, send at least $10. If you have access to Internet, you will get new versions by e-mail and you can always pick up the latest version at my home page.
  20.  
  21. Why am I doing this? Partly it is so that those people who do pay their ShareWare fees, will not have to be ruined, partly so that those people who don't pay their ShareWare fees will realize how good an offer this is and start paying them.
  22.  
  23. Being a ShareWare writer does not necessarily mean being swamped in admirers' letters. (I should have become a heavy metal singer, as my mother advised me to.)
  24.  
  25. So please send $5 or a corresponding amount in the currency of your choice, together with your name and address and any other important facts, that you think I should know, to:
  26.  
  27.     Niklas Frykholm
  28.     Rothoffsv. 37 A
  29.     S-903 42 Umeî
  30.     Sweden
  31.  
  32.     nisfrm95@student.umu.se
  33.     http://www.ts.umu.se/~r2d2/
  34.  
  35. 1.2. How to use it
  36.  
  37. This program is designed to be fairly simple to use for the layman (and still be more powerful than the pitiful excuse for a calculator that is shipped with the system). Yet the program offers advanced features, like graph-drawing and even its own programming language for the more experienced user.
  38.  
  39. The program calculates its result from an input string, which can be entered by clicking on the appropriate keys on the calculator or by simply typing it in. The program has been supplied with some intelligence, so it will realise that 3(2+1)+3sin3-1 means 3*(2+1) + 3*sin(3) - 1. This may however lead to some ambiguities, since in some cases, without parentheses there is really no way of knowing exactly what the user meant. 
  40.  
  41. For example if the user has typed 2*-x^2, did he/she/you mean 2*(-x)^2 or 2*(-(x^2)). When the user typed e^-x^2, did he/she/you mean e^(-(x^2)), (e^(-x))^2, or e^((-x)^2). If you suspect that your input string contains expressions like these, always include parentheses to make it exactly clear what you are meaning.
  42.  
  43. The notation used by this calculator comes from the following sources:
  44.  
  45.     1. Mathematics: + - / * ! ├ ╔
  46.     2. Basic: ^ rnd <> ╔
  47.     3. Pascal: = := ╔
  48.     4. C: && || & | % \ ╔
  49.     5: My own mind: *' +' -' /' ╔
  50.  
  51. 1.3. How to learn using the calculator
  52.  
  53. Start by opening the Calculator application. Select Layman's calculator from the Calculators menu. Try clicking on the keys and typing in expressions, until you have an idea of how it works. When you think you have got the hang of it, open the Scientific calculator.
  54.  
  55. The scientific calculator has a number of keys, that covers much of what you can do with the calculator. Apart from the ability to click a key instead of typing an expression, these keys can be useful as a reminder, when you have forgotten exactly what functions were available.
  56.  
  57. If you are curious and want to learn more, turn to this manual. It contains a full description of each one of the calculators, the entire set of functions that the calculator supports together with a thorough description of all the errors displayed by the calculator.
  58.  
  59. Many times a concept which applies to many calculators is only mentioned in the "simplest" calculator in which it occurs. For example, how to enter an expression is only mentioned in the Layman's Calculator section.
  60.  
  61. If you are unsure of the concept of a function it might be useful to check out the function glossary in the function reference part of this manual.
  62.  
  63. If you want to learn how to use the calculators built-in programming language to create your own programs, you should check out the section on the Programmable calculator in this manual. You should also browse through the entire set of functions, so that you have an idea of which tools are available to you. If you still have trouble grasping the concept of programming (which in fact is not so different from calculating), I suggest you get hold of a beginners book on programming. Many of the concepts of the Extended Calculator's programming language are similar to those of Basic, Pascal, and C.
  64.  
  65. 1.4. General editing instructions
  66.  
  67. In general, you will use either the keyboard or the mouse to enter an expression. As you type (or click) the expression will appear in a text box. By pressing the return key on the keyboard you will tell the computer to evaluate the expression.
  68.  
  69. This calculator does not work like the simple credit-card calculators. If you type "3 * 2 +" on such a calculator, the expression "3 * 2" will be evaluated in the instant that you press the "+" key, resulting in a "6" in the display window. The Extended Calculator will not calculate any part of the expression until you press the return key.
  70.  
  71. 1.5. Using multiple calculators
  72.  
  73. This program offers not one, but four separate calculators, this makes it possible for the program to offer both simplicity and power as well as a wide range of different functions.
  74.  
  75. You open a calculator by choosing its name from the Calculators menu. All the calculators can be open at the same time. You select the calculator you want to work with by clicking its window or selecting its name from the Calculators menu.
  76.  
  77. It should be noted, that the four Calculators should be considered only as different interfaces to the same set of data and functions. Thus, it is possible to write a program using the Layman's calculator, it will be an awesome task, though, since its interface wasn't designed for that purpose. 
  78.  
  79. At any given time, you should use the one of the four calculators that seems to make the most sense, considering the particular problem you are trying to solve.
  80.  
  81. 2. The Menu Options
  82.  
  83. 2.1. The Apple menu
  84.  
  85. About The Extended Calculator
  86. -----------------------------
  87. This option shows a nice picture with some information about the program.
  88.  
  89. 2.2. The File menu
  90.  
  91. Close
  92. -----
  93.  
  94. Selecting Close from the File menu closes the frontmost window.
  95.  
  96. Quit
  97. ----
  98. Selecting Quit from the File menu will, as usual, terminate the application.
  99.  
  100. 2.3. The Edit menu
  101.  
  102. Undo, Cut, Copy, Paste, Clear
  103. -----------------------------
  104. These options works as usual, with the exception that most of the time, Undo is not available. I know leaving out the Undo command isn't very Macintosh, but as I use to say, I'm a shareware writer, not the Microsoft corporation.
  105.  
  106. 2.4. The Calculator menu
  107.  
  108. This menu enables you to select between the various calculators supplied by this program. You simply pick the calculator you want to work with from the menu. If the calculator's window is closed it will be opened, otherwise it will just be brought to front.
  109.  
  110. 2.5. Calculator specific menus
  111.  
  112. In addition to the menus described above, each calculator may also have one or more menus of its own. (Menus that only appear when that calculator is active.) For information about those menus, I refer to the sections dealing with each one of the calculators.
  113.  
  114. 3. The Layman's Calculator
  115.  
  116. 3.1. The window
  117.  
  118. The window of the Layman's calculator contains a box where the calculations together with their results appear and a total of twenty keys. You can use the box as a normal text edit field, that is, you can type in an expression, use the mouse to select parts of it, cut, copy and paste, just as you are used to from any word processing application.
  119.  
  120. If you don't want to use the keyboard, you can use the mouse to click on the keys of the calculator. Clicking a number or the period will make that number appear in the display box. Clicking ( ) ├ * + - or ╓ will make the appropriate symbol appear in the display window. If you press ╓, the / symbol will appear, because this is the preferred symbol for division. (However, if you use the keyboard to type ╓, the computer will understand that this also is an expression for division.)
  121.  
  122. The key labeled EXP is used for entering very large or very small numbers using scientific notation. When you press the key EXP the capital letter E will appear in the display window. This E should be thought of as the *10^ you use when you write numbers in scientific notation. Thus 1E3 is the same as 1000 and 12E-3 is the same as 0.012. Note that although you can think of E as short for *10^, the letter E can only be used for entering numbers in scientific notation, not for a general calculation involving *10^. Expressions like 1E2.5 or 1E(2+3) will not be interpreted as 10^2.5 and 10^(2+3), but instead as 1E2 = 100 and 1E2 + 3 = 103 respectively. Also note that only the capital E can be used for this purpose, e is a symbolic constant ┼ 2.7182.
  123.  
  124. The key labeled = is as usual used for triggering the calculation. The same result can be obtained by pressing the return key in the display box. Note that pressing the = key on the keyboard will not produce this result, but instead result in a = in the display box. This is because the calculator uses = as a logical operator. (For an explanation see the functions reference, section 7.8) This may seem confusing, but on most simple calculators pressing the key = means "evaluate the expression", and I didn't want to interfere with this. If you are using the Scientific Calculator you will find that the key that means "evaluate the expression" is labeled as a return key. This is because the Scientific Calculator is aimed toward more advanced users.
  125.  
  126. 3.2. Entering an expression
  127.  
  128. As mentioned several times earlier there are basically two ways of entering an expression. You can use the keys on your keyboard or you can click on the keys displayed in a calculator's window. Which one to prefer is a matter of taste, although using the keyboard usually is faster. There is also the possibility of pasting in an expression from another program (or from this manual) directly into the display box.
  129.  
  130. There might be a difference between the Layman's Calculator and the calculator you are used to. Most simple calculators perform operations directly. If you press 9 and then the square root key the calculator will instantly calculate ├9 and display the result 3 in its display window. This calculator will however gather the keystrokes to an input string (which will be displayed in the display window) and not perform any calculations until you order it to (by pressing the = key on the calculator or the return key on your keyboard).
  131.  
  132. This means that if you press 9 and then the square root key the computer will display 9├, this is probably not what you intended. Pressing the ├ key first and then the 9 key will give the correct result ├9.
  133.  
  134. You use the parentheses to delimit parts of the expression that will be calculated before other parts. If you write 9*3+2 the calculator will multiply 9 by 3 and than add 2. By convention an expression with * will always be calculated before an expression with +. * is said to have higher operator precedence than +. (^ has still higher precedence so if you write 2*2^3 the computer will raise 2 to the power of 3 and then multiply the result by 2.) Suppose that this is not what you wanted. Suppose that you wanted to first add together 3 and 2 and then multiply the result by 9. In this case you would put 3 + 2 in parentheses to get the expression 9*(3+2) which will evaluate to 45, the result you wanted. 
  135.  
  136. 3.3. Using the results of calculations
  137.  
  138. When you need to use the result of a calculation, for example in a word processing document, you can type it of from the calculators window. A better method is sometimes to use the standard Cut, Copy and Paste commands provided by most Macintosh applications. Select the result you want to use and choose Cut or Copy, then switch to the word processing program and choose Paste.
  139.  
  140. 4. The Scientific Calculator
  141.  
  142. 4.1. The window
  143.  
  144. The Scientific calculator contains two display windows and two keyboards, one with big keys in the right half of the calculator, one with smaller keys in left half.
  145.  
  146. The upper window is used for entering expressions to be evaluated. The results of the calculations or any errors that occurred while calculating will be displayed in the lower window. If you enter an expression in the lower window and try to calculate it you won't get any result.
  147.  
  148. Clicking one of the calculator's keys will make the expression corresponding to the key appear in the display window, at the position of the caret. For a description of the different functions provided by the calculator I refer to the Functions reference part of this manual, section 7.
  149.  
  150. The expressions that appear when you press a key will not always look as the label of the key. Pressing "EXP" will display "E", pressing the key labeled something like "y├x" will display "^(inv(". (The reason for this is that the ├ sign is only used to evaluate square roots so 3├27 would not be interpreted as the third root of 27, which is 3, but instead as 3 times the square root of 27, which is 15.58.) So don't be surprised if the expressions displayed does not adhere to the letter of the label, they will in all cases adhere to its spirit.
  151.  
  152. When you press the key corresponding to a function with only one argument, only the function name will appear. Pressing the sin key will display "sin". However, when you press the key of a function taking several arguments, dummy arguments will appear. For example pressing the round key, will display: "round(x, noDecimals)". The reason for this is that when a function takes several arguments it could be painful to try to remember their order (should the number of decimals go before the value I was rounding off or should it go after?). The dummy arguments should of course be replaced with the real expression you want to evaluate. If you try to evaluate round(x, noDecimals) directly, you will get an error, since the calculator doesn't know of the word "noDecimals".
  153.  
  154. 4.2. Using complex numbers
  155.  
  156. While the Scientific Calculator does not fully support complex numbers (for example, it does not support raising a complex number to an arbitrary exponent or raising e to an arbitrary complex number) it is able to perform some simpler operations on them. (Adding, subtracting, multiplying, dividing, calculating their absolute and congruent values, their real and imaginary part.) This entry will only describe how complex functions are used on this calculator, not the functions themselves. For a description of those I refer to the Function Reference section, part 7.2, of this manual.
  157.  
  158. A complex number consists of a real and an imaginary part. In ordinary mathematics complex numbers are written 2 + 3i, 4 - 5i and so on, where i is the imaginary unit ├(-1). The Extended Calculator does not support this use of i (in the Extended Calculator i is one of the 25 single letter variables). A complex number in the Extended Calculator is instead written (real_part, imaginary_part). The numbers above would thus be written (2,3) and (4,5).
  159.  
  160. The complex arithmetic functions look like their real value counterparts but are followed by an apostrophe '. Thus to use the Extended Calculator to calculate (2+2i)/(-2-i) you would write. (2,2)/'(-2,-1), with the result (-1.2, -0.4). 
  161.  
  162. Note that only the Scientific Calculator can display complex numbers as the result of a calculation. If you use the Layman's calculator only the real part of the complex number will be displayed. Therefore, when you are fiddling with complex numbers, stick to the Scientific Calculator.
  163.  
  164. 4.3. Using variables
  165.  
  166. If you have used the M, RM, M+ and M- functions on an ordinary calculator, you are already familiar with the concepts of variables. A variable is a place where you store the result of a calculation to later retrieve it for use in another calculation. In this sense a variable may be thought of as a container with place for a number.
  167.  
  168. 4.3.1 Variables available
  169. -------------------------
  170. The Extended Calculator offers two types of variables. The first are the absolute variables a - z. Each one of the single lowercase letters from a to z (except e which is used as the base for the natural logarithm, e ┼ 2.718╔) gives access to a separate storage place for a number.  The other is the indexed variable provided by the function mem(x). This function acts as a different variable for every value of x, as long as x is between 0 and 99. Thus, mem(2) is one variable and mem(3) another. The function mem(x) gives you access to 100 different variables, each which may contain it's own number. If you write mem(101), you will get an error, because only 100 storage places are reserved for the function mem(x).
  171.  
  172. 4.3.2 Storing something in a variable
  173. -------------------------------------
  174. You store a value in a variable by using the assignment operator :=. You write the variable on the left side of the assignment operator and the value you want to assign to the variable on the right side. Here are some examples of assignment statements:
  175.  
  176.    a:=sin(╣) ^ 2
  177.    mem(37):=2 ^ (3 + 3 cos (1/2))
  178.  
  179. Trying to assign a value to something which is not a variable (2 := 1 +1) will generate an error.
  180.  
  181. 4.3.3 Using a variable's value
  182. ------------------------------
  183. To use the value stored or put in a variable, simply use the variable's name in the calculation. Examples:
  184.  
  185.    cos(mem(37))
  186.    sin(a)^mem(37)
  187.    a:=a+1
  188.    mem(mem(1)):=y^(mem(x))
  189.  
  190. Try to understand what each one of these statements actually does.
  191.  
  192. 4.4. Doing multiple calculations
  193.  
  194. The facility that makes the Scientific calculator able to display complex numbers in its lower display window also makes it possible to calculate a number of expressions at the same time, displaying all the results simultaneously in the result window. 
  195.  
  196. To use this facility, simply separate each calculation with the comma delimiter, for example, writing "2+3,2*3" and pressing return will make the result "(5, 6)" appear in the lower window.
  197.  
  198. 4.5. Using reverse polish notation
  199.  
  200. Reverse polish notation (usually abbreviated RPN) is a method for writing any expression without the use of parentheses. A thorough explanation of the concept of RPN is given in the Technical Reference section, section 10, of this manual.
  201.  
  202. The Extended Calculator converts the expression you type to RPN before evaluating them, the reason for this is that while ordinary notation might be more natural to you, RPN is more natural to the computer. Because of this, there is usually no need to write an expression in RPN, ordinary notation is generally superior. There might however be a rainy day when you want to try RPN for experimental purposes or just for the sheer fun of it.
  203.  
  204. To write an expression in RPN with the Scientific calculator all you have to do is to separate each element with a comma, thus if you wanted to calculate 5^((3+2)*4) using RPN you would simply write:
  205.  
  206.     3,2,+,4,*,5,^
  207.  
  208. Well, maybe not so simple, but isn't it FUN?
  209.  
  210. 5. The Graph Drawer
  211.  
  212. 5.1. The window
  213.  
  214. The window of the Graph Drawer is automatically redrawn in the background when you remove some element in the foreground so that other parts of the Graph Drawer's window show up. Since some graphs take quite a time to plot, this may cause a disturbing delay. To avoid this, don't have the Graph Drawer running in the background while using another calculator.
  215.  
  216. The window of the Graph Drawer contains the following elements:
  217.  
  218. The graph window
  219. ----------------
  220. This is where the graph will be displayed. It contains one or two graphs together with the x- and y-axis and occupies most of the Graph Drawer window.
  221.  
  222. The scroll arrows
  223. -----------------
  224. There are four scroll arrows to the left and to the right of the graph. These are used for scrolling the graph vertically and horisontally. For more information about scrolling see section 5.6 on Zooming and scrolling.
  225.  
  226. The origin button
  227. ----------------
  228. The origin button is placed in the lower right corner of the graph. It looks like a plus sign. Pressing the origin button will take you to the default view, which is the view that is used when the Graph Drawer is opened. This default view is centered about the origin with x ranging from -10 to 10 and y ranging from -5 to 5. You can change the default view using the Set Default View menu option, see section 5.2.
  229.  
  230. The zoom in button
  231. ------------------
  232. The zoom in button is situated in the lower right corner of the graph. It looks like a sine curve in close-up. Clicking it will zoom in on the center of the graph. Zooming is more thoroughly described in section 5.6 on Zooming and scrolling.
  233.  
  234. The zoom out button
  235. -------------------
  236. The zoom out button is just to the left of the zoom in button and looks like a sine curve. Clicking it will zoom out. For more information see section 5.6 on Zooming and scrolling.
  237.  
  238. The zoom to selection button
  239. ---------------------------
  240. The zoom to selection button is situated just above the other two buttons. Zooming is more thoroughly described in section 5.6 on Zooming and scrolling.
  241.  
  242. The graph specific controls
  243. ---------------------------
  244. Below the graph window are a number of controls. The appearance of these controls is specific to each one of the graphs and is therefore described in the section on each of the graphs.
  245.  
  246. The current coordinate display
  247. ------------------------------
  248. In the lower left corner of the Graph Drawer's window is a coordinate displayed. This coordinate is the coordinate corresponding to the current mouse position. You can move the mouse to parts of the curve to find out their coordinates. This is useful, for example for finding approximate max and min values.
  249.  
  250. 5.2. The Graph menu
  251.  
  252. Set Range
  253. ---------
  254. Set Range brings up a dialog box which allows you to specify which part of the graph you want to view. You type in the minimum and maximum values of x and y that you want to use and press OK.
  255.  
  256. Zooming Options
  257. ---------------
  258. Zooming Options brings up a dialog box that let's you specify how the different zoom buttons will work. For more information about this see section 5.6 on Zooming and scrolling.
  259.  
  260. Set Default View
  261. ----------------
  262. Set Default View will select the current view as the default view. If you zoom in, out and scroll, you can always return to the default view by pressing the cross-hair control in the lower right corner of the graph window.
  263.  
  264. Same Scaling x/y
  265. ----------------
  266. After you have zoomed to a selection several times the graph may be stretched or compressed horisontally or vertically, if the zoom window didn't have the same shape as the graph window. Choosing this menu option will correct this problem by forcing the same scaling upon the x- and y-axis.
  267.  
  268. Copy Graph
  269. ----------
  270. Selecting this option will put a copy of the graph in the clipboard. The copy can be pasted into a word processing program or a drawing program.
  271.  
  272. Find Intersection
  273. -----------------
  274. For more information about this option see the separate section on finding intersections, 5.7.
  275.  
  276. Numerical differentiation
  277. --------------------
  278. This option is described in section 5.8.
  279.  
  280. Numerical integration
  281. ---------------------
  282. This option is described in section 5.9.
  283.  
  284. Normal
  285. ------
  286. This option allows you to draw ordinary graphs, see section 5.3.
  287.  
  288. Polar
  289. -----
  290. This option allows you to draw polar graphs, see section 5.4.
  291.  
  292. Parametric
  293. ----------
  294. This option allows you to draw parametric graphs, see section 5.5.
  295.  
  296. 5.3. Ordinary graphs
  297.  
  298. An ordinary graph consists of all pairs of points (x,y) that solves an equation of the type y=f(x). Each value of x is associated with one value of y.
  299.  
  300. The ordinary graph drawer can draw two graphs, one consisting of all points (x,y) that solves the equation y=f(x) and one consisting of all points (x,z) that solves the equation z=g(x).
  301.  
  302. The ordinary graph window has two boxes where you can enter the two functions that will be plotted. The entries should be of the type y:=f(x) and z:=g(x), where f(x) and g(x) are the two functions you want to plot. If you want to plot a sine curve and a cosine curve at the same time, you would write "y:=sin x" in the upper box and "z:=cos x" in the lower box.
  303.  
  304. The ordinary graph window also contains a check box labeled Shadow if undef. Some functions are not defined for all values of x. For example ├x is only defined as a real number when x is positive or zero. Normally the graph drawer will simply skip the parts of the graph that are undefined, selecting this option will instead make the graph drawer shadow those parts of the graph, making it easy to see exactly the parts that are undefined. If a function is undefined in specific singular points (like 1/sin x), the Graph Drawer will usually fail to detect these points, this is because detecting such points requires a thorough examination of the functions involved, using calculus.
  305.  
  306. 5.4. Polar graphs
  307.  
  308. A point in the plane can be specified by the ordinary rectangular coordinates (x,y), x being the perpendicular distance from the y-axis and y being the perpendicular distance from the x-axis. Another way of specifying a point in the plane is by the distance from the function to the origin and the angle that a line from the point to the origin makes with the positive x-axis. If you plot all the points satisfying the equation r = f(t), where r is the distance from the origin to the point and t is the angle a line from the point to the origin makes with the positive x-axis you will get a polar curve. Thus, r = 2 would represent a circle of radius 2.
  309.  
  310. The polar curve window has a box which let you specify which equation you want to use. You enter the equation as r := f(t), where f(t) is the polar function you want to plot. For example to draw a spiral you could write "r := ├ t" in the box.
  311.  
  312. The three boxes below are used to control which part of the curve is drawn and how carefully. An ordinary graph has only one point for each x-value so when you are drawing it you only have to step through each x-value in the graph window and plot the corresponding y-value. A polar graph may however loop back into itself, making it hard to determine which parts of the graph that will end up in the graph window. (Consider the graph r := 1/t close to the origin.) Therefore, there must be some way of determining which parts of the graph will be drawn.
  313.  
  314. t-min is the first value for which the function will be plotted, t-max is the last value and Steps is the number of measurements that will be taken along the path. Usually t-min will be 0 and t-max 3.14 or 6.28. Note that you cannot enter an arithmetic expression (such as 2╣) into these boxes, only numbers will do. The larger the number of steps you use the longer it will take to draw the curve, but the less jagged it will be.
  315.  
  316. If you have specified an enormous number of steps and the time it takes to draw the graph becomes unbearable, you can interrupt the process by holding down the command key and pressing the period (.) or by pressing the escape key. This will interrupt any calculation the Extended Calculator is busy with.
  317.  
  318. Note that although the Graph Drawer makes use of polar coordinates when drawing a polar graph, the coordinates displayed in the lower left part of the window will still be rectangular coordinates.
  319.  
  320. 5.5. Parametric graphs
  321.  
  322. A parametric graphs consists of all the points (x,y) in the plane satisfying x = f(t) and y = g(t) for some value t. Specifying separate values for x and y allows you to draw complex functions, like conic sections, easily. Often a useful way of thinking of parametric graph is to imagine t being a variable representing time (although this is by no means necessary). The graph will then be the path traced out by a point traveling so that its x-coordinate at any given time t is f(t) and its y-coordinate at any given time t is g(t).
  323.  
  324. In the box of the parametric equation you enter the two equations for x and y separated by a semi-colon. Thus entering "x := 2 cos t; y := 2 sin t" will produce a circle of radius 2.
  325.  
  326. As with the polar graph (and for the same reasons) the three boxes below are used for determining which parts of the graph that will be drawn and with what accuracy. If we use the time-analogy again, this specifies between which times the path of the particle will be traced and how many samples of the particle's position that will be taken along the path.
  327.  
  328. 5.6. Zooming and scrolling
  329.  
  330. To specify which part of a graph you want to look at you use the zooming and scrolling options to set the x-min, x-max, y-min and y-max of the graph window.
  331.  
  332. The most direct way do this is by selecting Set Range from the graph menu, this however, requires that you know exactly what part of the graph you want to look at, and even then it is not always the fastest option.
  333.  
  334. The scrolling arrows allow you to scroll along the graph to see how it changes. Since scrolling of the graph requires the graph to be redrawn, scrolling graphs often appears sluggish. Scrolling an ordinary graph vertically or scrolling polar or parametric graphs is often especially slow, since it requires the entire graph to be redrawn. Although slow, scrolling may still be useful under some circumstances.
  335.  
  336. The default view button, next to the down and right scroll arrows, which resembles a + will take you to a default view. When you start up the application this default view will be set to x ranging from -10 to 10 and y ranging from about -5 to about 5. You can however change the default view by specifying a new default view in the Zooming Options dialog, or choosing the Set Default View option when you have a pleasing view.
  337.  
  338. The zoom in button (resembles a sine curve in close-up) will zoom in towards the center of the graph. The default zooming is set to 200 %, you can however change this by using the Zooming Options dialog.
  339.  
  340. The zoom out button (resembles a sine curve) will zoom out of the graph. The default zooming is set to 25 %, but can be changed using the Zooming Options dialog box.
  341.  
  342. The zoom to selection button (above the other zoom buttons) zooms in to a part of the graph that you have selected. You select a part of the graph by dragging with the mouse (a flashing rectangle will appear). Clicking the zoom to selection button will zoom in so that the part you selected covers the entire graph window.
  343.  
  344. If you have used the zoom to selection button or the Set Range option you may have stretched the graph in some direction (so that a line making 45í with the x-axis in the actual graph will make another angle with the x-axis in the drawing in your window). Sometimes this doesn't matter, but sometimes you want to use the same scaling on the x- and y- axis. Selecting Same Scaling x, y will take care of this.
  345.  
  346. 5.7. Finding intersections
  347.  
  348. When you are using the ordinary graph drawer and have two graphs in the same window you can use the menu option Find Intersection, to find a point where the two graphs intersect. Note that you cannot use this to find the point where a graph intersects one of the coordinate axis, unless you set one function to be y := 0.
  349.  
  350. To find the intersection of two curves, drag with the mouse to select the part where the two curves intersect and select Find Intersection from the graph menu. The Graph Drawer will use the bisection method to find the point where the two curves intersect. If the two curves do not intersect in the selection you have made or if they intersect more than once, you will get an error message.
  351.  
  352. 5.8. Numerical differentiation
  353.  
  354. The Graph Drawer will automatically perform numerical differentiation on the graph for you. Select Numerical Differentiation from the graph menu and specify in which x-value you will differentiate (or in which t-value, for parametric and polar graphs) and the Graph Drawer will calculate a numerical derivative. If you have selected a part of the curve, the left limit of the selection will be used as a prompt in the differentiation dialog.
  355.  
  356. To do this it adds a tiny fraction to x, calculates y, then subtracts the tiny fraction from x and calculates a new y-value. It then divides the difference between the values with twice the tiny fraction. 
  357.  
  358. For polar and parametric curves the numerical differentiation will not calculate dx/dt, dy/dt or dr/dt, but dy/dx in the point t, that is, the slope of the curve in that point.
  359.  
  360. 5.9. Numerical integration
  361.  
  362. The Graph Drawer will automatically perform numerical integration for you. Select a part of the graph by clicking and dragging and select Numerical Integration from the Graph menu. This will bring up a dialog box, which lets you specify the integration limits and how many steps will be used for the calculation.
  363.  
  364. To calculate the integral, the calculator uses Simpson's formula for ordinary graphs and the trapezoid formula for polar and parametric graphs.
  365.  
  366. Note that for polar and parametric graphs the integral calculated is not ║x dt, ║y dt or ║r dt, but ║y dx when t ranges from the lower integration limit to the upper.
  367.  
  368. Note that if a parametric or polar curve goes in the negative x direction and y is positive this integral will be negative (since the differential dx will be negative).
  369.  
  370. 6. The Programmable Calculator
  371.  
  372. 6.1. The window
  373.  
  374. The window of the programmable calculator contains one big field which is used for entering the program, a scroll bar to the left for scrolling through the program, a size box in the lower left corner for adjusting the size of the window and an information bar at the bottom of the window.
  375.  
  376. The information bar displays how many memory units that are occupied by the program. There are 1000 units available. If you use up all these units, tough luck. A future version of the Extended Calculator might be able to run your program, but this one won't. It is worth saying once again that the Extended Calculator is intended for small programs for mathematical or humorous purposes (whichever comes closer to your heart), not for large scale programming. 1000 units is in fact sufficient for most programs you will want to write.
  377.  
  378. The information bar also displays the value of the common variables a, b, c, x, y, z. Sometimes it is convenient to store the results of a program in one of these variables and just reading the value from the information bar when the program is done, rather than bringing up a dialog box presenting the result.
  379.  
  380. 6.2. The Programmable menu
  381.  
  382. Run
  383. ---
  384. Run tells the computer to start executing the program beginning with the first line and continuing downwards. If the program seems to get stuck in an infinite loop or something, you can hold down the command key and press the period to halt program execution.
  385.  
  386. Open
  387. ----
  388. Will open a previously saved program or any other text file and display the result in the programming window.
  389.  
  390. Save
  391. ----
  392. Will save the program you are working on under it's current name. If it doesn't have one the standard dialog box will allow you to baptize and place it.
  393.  
  394. Save As
  395. -------
  396. Will bring up the standard dialog box for saving and allow you to enter a name and select a location where the program will be saved.
  397.  
  398. 6.3. General editing instructions
  399.  
  400. You enter the program in the same way as you enter any text file. In fact, you can if you wish, use another editor than the Extended Calculator (such as your favorite word processing program) for entering the program, save it as a text file and then open it from the calculator.
  401.  
  402. One difference between this editor and the usual ones is that pressing the tab key in this editor will produce four spaces in a row. This is useful, since it is considered good programming style to indent the lines affected by a program flow controlling statement, such as below:
  403.  
  404.    while (x<100);
  405.        x:=x+1;
  406.        beep;
  407.    end;
  408.  
  409. The Extended Calculator is case sensitive, but does not care about spaces or line feeds.
  410.  
  411. When you have finished editing the program, select Run from the Programmable menu and program execution will start. If the program gets stuck in a loop holding the command key and pressing a period (.) will halt execution.
  412.  
  413. 6.4. Programming vs. calculation
  414.  
  415. Assuming you know how to use the Extended Calculator for ordinary calculations, how do you get started with programming? In fact the big difference between programming and calculating is not that big. A program may be considered simply to be a long calculation. Indeed, the Extended Calculator makes no difference between programs and other calculations, they are treated in exactly the same way. There are however three points worth mentioning on this issue.
  416.  
  417. a. A program contains more than one statement
  418. ---------------------------------------------
  419. A statement should be thought of as an instruction to the computer, it is comparable to the sentence in ordinary languages . Ordinary calculations contain only a single statement, like sin(╣/6)^2, most programs will however contain several statements. The statements are separated by a semi-colon ;. Usually each statement begins a new line, although this is not necessary. Thus if you write:
  420.  
  421.    sin (3);
  422.    2+6*12;
  423.  
  424. in the window of the programmable calculator and select Run, the computer will first calculate sin(3) and then proceed to the next line and calculate 2+6*12. Check out the sample programs to get a better idea of how this works.
  425.  
  426. b. A program makes use of variables
  427. -----------------------------------
  428. You may use variables in other calculations, but variables are (often) crucial to a program. If you have used an ordinary table calculator you will probably have made use of its memory functions (M, M+, M- and RM) to store and retrieve information. A variable may be thought of as one such memory location. The extended calculator gives you access to 125 such variables (through the letters a - z and the function mem). Each of these may contain a different value.
  429.    What makes variables crucial to programming is that whatever result one statement produces is lost when the computer proceeds to the next statement. If you run the sample program above, the computer will first calculate sin(3), it will then forget whatever the result of this calculation was and proceed with calculating 2+6*12, when that is done, it will forget the result and continue with the next statement, so this program won't do you much good. If you want to keep the results of a calculation you must assign them to a variable. After running the program:
  430.  
  431.    a:=sin(3);
  432.    b:=2+6*12;
  433.  
  434. the variable a will contain the value of sin(3) and the variable b will contain the value of 2+6*12.
  435.  
  436. c. A program uses functions to control program flow
  437. ----------------------------------------------------
  438. Normally a program is executed line by line from the top to the bottom. Sometimes, however, this is not what you want. You may want the computer to perform a certain task repeatedly 200 times or you may want it to perform different tasks depending on the values of a variable. In these cases there are functions that let you control program flow. The space here does not allow for an explanation of the different kinds of control statements. Check out section 6.6 for a description of this.
  439.  
  440. 6.5. Using variables
  441.  
  442. A variable may be thought of as a memory location, or to be more physical, as a container where you can store a number. You can store the result of a calculation in a variable and retrieve it later to make use of it in another calculation.
  443.  
  444. 6.5.1 Variables available
  445. -------------------------
  446. The Extended Calculator offers two types of variables. The first are the absolute variables a - z. Each one of the single lowercase letters from a to z (except e which is used as the base for the natural logarithm, e┼2.718╔) corresponds to a certain location in the memory.  The other is the indexed variable provided by the function mem(x). This function acts as a different variable for every value of x, as long as x is between 0 and 99. Thus mem(2) is one variable and mem(3) another. Thus, the function mem(x) gives you access to 100 different variables, each which may contain its own number. If you write mem(101) you will have an error, because mem only gives access to 100 memory locations.
  447.  
  448. 6.5.2 Storing something in a variable
  449. -------------------------------------
  450. You store a value in a variable by using the assignment operator :=. You write the variable on the left side of the assignment operator and the value you want to assign to the variable on the right side. Here are some examples of assignment statements:
  451.  
  452.     a:=sin(╣) ^ 2;
  453.     mem(37):=2 ^ (3 + 3 cos (1/2));
  454.  
  455. Trying to assign a value to something which is not a variable (2 := 1 +1) will generate an error.
  456.  
  457. 6.5.3 Using a variable's value
  458. ------------------------------
  459. To use the value stored or put in a variable, simply use the variables name in the calculation. Examples:
  460.  
  461.     cos(mem(37));
  462.     sin(a)^mem(37);
  463.     a:=a+1;
  464.     mem(mem(1)):=y^(mem(x));
  465.  
  466. Try to understand what each one of these statements actually does.
  467.  
  468. 6.6. Controlling program flow
  469.  
  470. The Extended Calculator usually executes a program line by line, but sometimes you want it to do different things depending on the value of some variable or to perform a certain task repeatedly until a certain condition is satisfied. To do this you use functions that control program flow.
  471.  
  472. The Extended Calculator uses only two functions for controlling program flow. This is for two reasons. 1) Keeping the functions to a minimum reduces confusion and developing time. 2) Anything that can be done with the program flow can be done with these two functions, it may require some extra thinking though.
  473.  
  474. 6.6.1 The if - else - end construction
  475. ---------------------------------------
  476. The if function lets you perform some statements depending on the value of a variable (or some other condition). In your program, the statement will look like this:
  477.  
  478.   if (some condition);
  479.       lines that will be executed if the condition is true
  480.   else;
  481.       lines that will be executed if the condition is false
  482.   end;
  483.  
  484. It is possible to leave out the else statement and the lines following that (you must include the end, though, otherwise the computer won't know which lines are affected by the if-statement. A silly sample program using if might be:
  485.  
  486.   x:=message("Is it OK to beep?");
  487.   if (x=1);
  488.       beep;
  489.       message("Nice beep, huh?");
  490.   else;
  491.       message("OK, I'll keep quiet!");
  492.   end;
  493.  
  494. 6.6.2 The while-end construction
  495. -----------------------------
  496. The while end construction lets you execute some lines repeatedly while a certain condition is true. In your program it will look like this:
  497.  
  498.   while (some condition);
  499.       some lines that will be repeated
  500.   end;
  501.  
  502. An even sillier sample program than the one in section 6.6.1 might be:
  503.  
  504.   x:=message("Is it OK to beep?");
  505.   while(x=1);
  506.       beep;
  507.       x:=message("Wanna hear another beep?");
  508.   end;
  509.  
  510. 6.7. Comparison of control functions
  511.  
  512. The Extended Calculator's supply of expressions controlling program flow is small, nevertheless, using only these simple expressions, most common control structures can be mimicked. In this section we will look at some control structures from other languages and see how to implement them with the Extended Calculator's code.
  513.  
  514. 6.7.1 goto
  515. ----------
  516. There is no thing similar to the goto statement in the calculator's language. However, there is no situation where a goto statement is absolutely necessary. Many common languages, like C and Pascal, lacks a goto statement or discourages the use of it, since it often leads to bad programming style. If you are unsure of how to program without using goto, check out a primer on C or Pascal.
  517.  
  518. 6.7.2 gosub, functions
  519. ----------------------
  520. This program does not allow subroutines or the declaration of functions or procedures. If this was a program intended for writing big applications, this would of course be a major flaw. This program is however intended for small-scale programming, which is quite possible without the declaration of functions. Anything that normally would have been a function you will have to type out to its full length everywhere it would be used.
  521.  
  522. 6.7.3 else if
  523. -------------
  524. This program does not have an else if statement. You can however easily write code that behaves exactly like such a statement, for example:
  525.  
  526.     if (a);
  527.         (do something);
  528.     else if (b);
  529.         (do something else);
  530.     end;
  531.  
  532. would in the language of the Extended Calculator be written as:
  533.  
  534.     if (a);
  535.         (do something);
  536.     else;
  537.         if (b);
  538.             (do something else);
  539.         end;
  540.     end;
  541.  
  542. or maybe as:
  543.  
  544.     if (a);
  545.         (do something);
  546.     end;
  547.     if (not(a) && b);
  548.         (do something else);
  549.     end;
  550.  
  551. 6.7.4 switch, case
  552. ------------------
  553. The switch and case statements in C and Pascal (somewhat similar to the ON x GOSUB statement in Basic), can easily be emulated using a series of if-statements.
  554.  
  555.     switch(x) {
  556.         case 1:
  557.             doSomething;
  558.             break;
  559.         case 2:
  560.             doSomethingElse;
  561.             ╔
  562.  
  563. would be written as:
  564.  
  565.     if (x=1);
  566.      doSomething;
  567.     end;
  568.     if (x=2);
  569.      doSomethingElse;
  570.           ╔
  571.  
  572. 6.7.5 for, next
  573. ---------------
  574. A for-next statement can be simulated using the while construction, for example╔
  575.  
  576.     for (x=1; x<10; x++)
  577.         doSomething;
  578.  
  579. would be written as
  580.  
  581.     x:=1;
  582.     while (x<10);
  583.         doSomething;
  584.         x:=x+1;
  585.     end;
  586.  
  587. 6.8. Getting data from the user
  588.  
  589. If you want a program to be flexible you must have some way of getting data from the user, data that you later can use in the program.
  590.  
  591. 6.8.1 Getting Data From Dialogs
  592. -------------------------------
  593. message ("some text")
  594.  
  595. The message functions provides a way of getting simple validation (OK or Cancel). Calling message() will bring up a dialog with the text between the quotation marks. If the user clicks OK the function will return 1, if the user clicks Cancel it will return 2. The function show() (described in section 6.9.1) can be used in a similar fashion.
  596.  
  597. if (message("OK to beep")=1);
  598.     beep;
  599. end;
  600.  
  601. get ("some text", number)
  602.  
  603. This function is useful if you need the user to input a number. Calling get() will bring up a dialog displaying the text within the quotation marks. The number sent to the function will be displayed as a prompt in a box, where the user can enter a number. The function will return the number the user has entered.
  604.  
  605. w:=get("What is your weight in kilos",72);
  606.  
  607. 6.8.2 Getting Data From The Mouse
  608. ---------------------------------
  609. HMouse
  610.  
  611. This function will return the horizontal position of the mouse relative to the top left corner of the window.
  612.  
  613. VMouse
  614.  
  615. This function will return the vertical position of the mouse relative to the top left corner of the window. Unlike what you may be used to a higher number means the mouse is closer to the bottom of the screen.
  616.  
  617. button
  618.  
  619. This function will return 1 if the mouse button is being pressed and 0 if it is not being pressed.
  620.  
  621. 6.9. Displaying data to the user
  622.  
  623. There are several ways of displaying data to the user. The simplest way is to store the value you want to display in one of the variables a, b, c, x, y and z, the user can then easily read the value from the information bar when the program has ended.
  624.  
  625. 6.10. Presenting data in dialogs
  626. --------------------------------
  627. show ("some text", value)
  628.  
  629. This function will bring up a dialog box displaying the text within the quotation marks immediately followed by the value. If the user clicks OK the function will return 1, if he clicks Cancel it will return 2. This function is useful for displaying a single number as the result of a calculation, or as a way of getting data from the user. (See 6.8 Getting data from the user). If you just want to display a message and no value use the function message. (See Getting data from the user.)
  630.  
  631.     show ("The sine of 3 is: ",sin 3);
  632.  
  633. 6.11. Presenting data in a graphic window
  634. -----------------------------------------
  635. The Extended Calculator can bring up a graphic window where text, numbers and various graphic objects can be drawn. The functions for handling graphics are quite many and I refer to the sections Drawing 7.4, Printing text and numbers 7.11 and Window functions 7.17 of the Function Reference part of this manual, here I will just explain some of the functions.
  636.  
  637. text ("some text", left, top, right, bottom, alignment);
  638.  
  639. Draws the text within the quotation marks in the box determined by the coordinates. Alignment should be 0 - left alignment, -1 right alignment or 1 - center. You can use the functions TFont, TFace, TSize and TMode to determine the appearance of the text that will be drawn.
  640.  
  641. text ("You guessed right!",20,20,100,100,1);
  642.  
  643. drnu (value, left, top, right, bottom);
  644.  
  645.  This function is similar to text, the difference is that it draws a number instead of text. It draws the number value in the box specified by the coordinates. The functions TFont, TFace, TSize and TMode can be used to control the appearance of the text. 
  646.  
  647. 6.12. Sample programs
  648.  
  649. Here are some sample programs, which hopefully will help you understand the concepts presented in this section.
  650.  
  651. 6.12.1 Guessing game
  652.  
  653. "(uses 93 memory units)"
  654.  
  655. a:=random(1,100);
  656. h:=100;
  657. l:=0;
  658. x:=get("Guess a number between 1 and 100!",int((h+l)/2));
  659. n:=1;
  660. while (x<>a);
  661.     if (x<a);
  662.         l:=x;
  663.         x:=get("Wrong, guess higher!",int((h+l)/2));
  664.     else;
  665.         h:=x;
  666.         x:=get("Wrong, guess lower!",int((h+l)/2));
  667.     end;
  668.     n:=n+1;
  669. end;
  670. show("You finally got it right. Total number of guesses:",n);
  671.  
  672. 6.12.2 Mirror drawer
  673.  
  674. "(uses 91 memory units)"
  675.  
  676. a:=HMouse;
  677. b:=VMouse;
  678. while(not(button));
  679.     PPat(random(1,5));
  680.     x:=HMouse;
  681.     y:=VMouse;
  682.     line(a,b,x,y);
  683.     line(600-a,b,600-x,y);
  684.     line(a,300-b,x,300-y);
  685.     line(600-a,300-b,600-x,300-y);
  686.     a:=x;
  687.     b:=y;
  688. end;
  689.  
  690. 7. Function Reference
  691.  
  692. 7.1. Function glossary
  693.  
  694. Mathematically speaking a function is something that maps a set of input values (which may be real numbers, complex numbers or something you'd rather not hear about) to a set of output values.
  695.  
  696. In plain language a function works like the famous black box. You stuff something in one end and something pops out of the other end. The things you stuff in are usually enclosed in parenthesis after the functions name, sin(3), cos(2), but there are exceptions, like 2 * 3 or 4!. 
  697.  
  698. In computer jargon the things that are stuffed in are called "arguments", and the arguments are said to be "sent to the function". Whatever pops out is said to be "returned from the function". When you write sin(x) the argument x is sent to the function sin, which returns the sine of x. 
  699.  
  700. In a calculation the value of a function is the value it returns. If you write 2*sin(3), this might be read as: "2 times the value returned when the argument 3 is sent to the sine function", but why bother, when it is much simpler to say "2 times sine of 3".
  701.  
  702. Some functions (like PNormal) does not return any value, but instead, perform an action of some sort. Since such "functions" are not functions in the mathematical sense, some computer languages refer to them as procedures. Others, however, do not bother to make a difference.
  703.  
  704. 7.2. Complex
  705.  
  706. (a, b) +' (c, d), (a, b) -' (c, d), (a, b) *' (c, d), (a, b) /' (c, d)
  707.     Complex arithmetic. 
  708.     (2, 3) *' (1, 2) = (2 + 3i) * (1 + 2i) = 2 + 7i + 6i^2 = -4 + 7i = (-4, 7).
  709.     Note that a complex number is always denoted (a, b), the program does not make use of the imaginary unit i. You cannot write 1 + 2i, you must write (1, 2).
  710.  
  711. cabs (a, b)
  712.     The absolute value of the complex number a + bi.
  713.     cabs (3, 4) = 5.
  714.  
  715. con (a, b)
  716.     The congruent number to the complex number a + bi.
  717.     con (3, 4) = (3, -4).
  718.  
  719. im (a, b)
  720.     The imaginary part of the complex number a + bi.
  721.     im(3, 4) = 4.
  722.  
  723. re (a, b)
  724.     The real part of the complex number a + bi.
  725.     re (3, 4) = 3.
  726.  
  727. angle (x, y)
  728.     The angle the line from the origin to the point (x, y) makes with the x-axis.
  729.  
  730. radius (x, y)
  731.     The distance from the point (x, y) to the origin.
  732.  
  733. x-coor (radius, angle)
  734.     The x-coordinate of the point with polar coordinates (radius, angle).
  735.  
  736. y-coor (radius, angle)
  737.     The y-coordinate of the point with polar coordinates (radius, angle).
  738.  
  739. 7.3. Dialogs
  740.  
  741. beep
  742.     Makes the computer beep.
  743.  
  744. get ("some text", number)
  745.     Displays the text "some text" in a dialog box and offers the user to input a number. The number passed to the function will be used as a prompt in the dialog box. The function returns the number the user types in the dialog box.
  746.     a:=get("Area of sphere:", 10).
  747.  
  748. message ("some text")
  749.     Displays the text "some text" in a dialog box. If the user clicks OK the function returns 1 if the user clicks Cancel, it returns 2.
  750.     g:=message ("Continue long calculation?")
  751.  
  752. show ("some text", a)
  753.     Displays the text "some text" together with the value a in a dialog box. If the user clicks OK the function returns 1, if the user clicks Cancel it returns 2.
  754.     show ("The result is", x);
  755.  
  756. 7.4. Drawing
  757.  
  758. PRect (left, top, right, bottom), FRect, IRect, ERect
  759.     Paints, Frames, Inverts or Erases a rectangle with the specified coordinates.
  760.     FRect (10,10, 100,100);
  761.  
  762. POval(left, top, right, bottom), FOval, IOval, EOval
  763.     Paints, Frames, Inverts or Erases an oval with the specified coordinates.
  764.     IOval (10, 40, 20, 100);
  765.  
  766. PArc(left, top, right, bottom, startAngle, angleSpan), FArc, IArc, EArc
  767.     Paints, Frames, Inverts or Erases an arc with the specified coordinates. The angles are measured in degrees. StartAngle is the angle where the computer will start drawing and angleSpan is the central angle of the arc. An angleSpan of 180 will produce a semi-circle, for example.
  768.     EArc (10, 10, 20, 20, 0, 90);
  769.  
  770. line (x1, y1, x2, y2)
  771.     Draws a line from the point (x1, y1) to the point (x2,y2).
  772.     line (10,10,100,100);
  773.  
  774. cls
  775.     Clears the drawing area.
  776.  
  777. PNormal
  778.     Sets the pen to the normal 1 x 1 pixel pen with black pattern.
  779.  
  780. PSize (h, v)
  781.     Sets the horizontal size of the pen to h and the vertical size to v.
  782.  
  783. PMode (x)
  784.     Sets the penmode to x. x must be one of the following values:
  785.     08 = copy the pen's pattern to the drawing
  786.     09 = or the pen's pattern with the drawing
  787.     10 = xor the pen's pattern with the drawing
  788.     11 = bic the pen's pattern with the drawing
  789.     12 = copy the pen's pattern to the drawing and invert
  790.     13 = or the pen's pattern with the drawing and invert
  791.     14 = xor the pen's pattern with the drawing and invert
  792.     15 = bic the pen's pattern with the drawing and invert
  793.  
  794. PenPat(x)
  795.     Sets the pen's pattern to x. x must be one of the following values:
  796.     1 = white
  797.     2 = light gray
  798.     3 = gray
  799.     4 = dark gray
  800.     5 = black
  801.  
  802. Color(red, green, blue)
  803.     Sets the pen's color to the specified RGB value. Possible values range from 0 to 100, so white is Color(100,100,100), black is Color(0,0,0) and yellow is Color(100,100,0).
  804.  
  805. 7.5. Economic functions
  806.  
  807. fv (nper, amm, int)
  808.     Assuming you for nper periods pays the amount amm to a bank account or an other investment and that the interest has a grow factor of int for each period, this function calculates the future value.
  809.     If you are paying $5 each month to a bank account with 1 % interest per month, after 12 months you will have fv(12, 5, 1.01) on the bank account.
  810.  
  811. nper(fv, amm, int)
  812.     Assuming you are paying the amount amm each period to a bank account, and that the interest has a grow factor of int for each period, this function calculates how many periods required to achieve the sum fv.
  813.     You want to save $2000 by paying $20 each month to a bank account, to an interest of 1 % per month. This will take you nper(2000,20,1.01) months.
  814.  
  815. amm(fv, nper, int)
  816.     Assuming you make nper payments (one each period) to a bank account, with an interest grow factor of int each period, this function calculates the amount you have to pay each period if you want to have the amount fv by the end of the payments.
  817.    You want to save $2000 in 24 months on a bank account which pays 1 % interest per month. In that case, you will need to deposit amm(2000,24,1.01) each month.
  818.  
  819. 7.6. Exponential functions
  820.  
  821. exp (x)
  822.     Returns e^x, where e is the base of the natural logarithm.
  823.  
  824. ln (x)
  825.     Returns ln(x), that is the natural logarithm of x.
  826.  
  827. lg (x)
  828.     Returns lg(x), the 10-logarithm of x.
  829.  
  830. log(base, x)
  831.     Returns the logarithm of x, with base as base.
  832.  
  833. 7.7. Integer
  834.  
  835. com (n, k)
  836.     The number of combinations of n and k. The number of ways in which you can choose k elements of n if you are not concerned about the order,  n! / (k! (n - k)!).
  837.     com (5, 3) = 5! / 2! 3! = 10.
  838.  
  839. per (n) or n!
  840.     The number of permutations of n. The number of ways in which you can arrange n elements.
  841.     per (4) = 1 * 2 * 3 * 4 = 24.
  842.  
  843. random (lowLim, upLim)
  844.     A random integer between lowLim and upLim. 
  845.     random(1, 6) simulates an ordinary die.
  846.  
  847. 7.8. Logical functions
  848.  
  849. x and y, x & y
  850.     Returns the bitwise and of x and y.
  851.  
  852. x or y, x | y
  853.     Returns the bitwise or of x and y.
  854.  
  855. ~x
  856.     Returns the bitwise not of x.
  857.  
  858. not (x)
  859.     Returns the logical not of x.
  860.  
  861. x && y
  862.     Returns the logical and of x and y.
  863.  
  864. x || y
  865.     Returns the logical or of x and y.
  866.  
  867. 7.9. Memory functions
  868.  
  869. a - z
  870.     The single letters a to z are used as variables. (With the exception of e, which is a constant ┼ 2,718╔). This means that they can be assigned values, which later can be used.
  871.  
  872. mem(x)
  873.     The function mem(x) provides access to 100 memory cells, which may be used as variables. The number x is an index that tells which of the 100 cells you are referring to. It should be in the range [0, 99].
  874.  
  875. 7.10. Mouse functions
  876.  
  877. HMouse
  878.     The horizontal position of the mouse.
  879.  
  880. VMouse
  881.     The vertical position of the mouse.
  882.  
  883. button
  884.     Has the value 1 if the mouse button is currently being pressed and the value 0 otherwise.
  885.  
  886. 7.11. Printing text and numbers
  887.  
  888. text ("some text", left, top, right, bottom, alignment);
  889.     Draws the text "some text" in the box with the specified coordinates and the specified justification. The alignment must be one of the following values:
  890.     0 - align left
  891.    -1 - align right
  892.     1 - center
  893.  
  894. drnu (a, top, left, bottom, right)
  895.     Draws the number a in the specified rectangle.
  896.  
  897. TFace(x)
  898.     Sets the text face to x, where x may be one of the following:
  899.     00 - plain text
  900.     01 - bold
  901.     02 - italic
  902.     04 - underline
  903.     08 - outline
  904.     16 - shadow
  905.     32 - condense
  906.     64 - extended
  907. If you or-together several of these values all the styles corresponding to the values will be applied.
  908.  
  909. TMode(x)
  910.     Sets the transfer mode for drawing text to x, where x is one of the following:
  911.     1 - or the text with the drawing
  912.     2 - xor the text with the drawing
  913.     3 - bic the text with the drawing
  914.  
  915. TFont(x)
  916.     Sets the text font to x, the font numbers of some common fonts are:
  917.     00 - System font (Chicago)
  918.     01 - Application font (Helvetica)
  919.     02 - New York
  920.     03 - Geneva
  921.     04 - Monaco
  922.     05 - Venice
  923.     06 - London
  924.     07 - Athens
  925.     08 - San Francisco
  926.     09 - Toronto
  927.     11 - Cairo
  928.     12 - Los Angeles
  929.     20 - Times
  930.     21 - Helvetica
  931.     22 - Courier
  932.     23 - Symbol
  933.     24 - Mobile
  934.  
  935. TSize(x)
  936.     Sets the size of the text to x points.
  937.  
  938. 7.12. Program flow
  939.  
  940. if (a); [some lines] end;
  941.     If a is true, the lines before the end-command are executed, if a is false, the lines are skipped.
  942.     if (x>3); message ("x is bigger than 3"); end;
  943.  
  944. if (a); [part1] else; [part2] end;
  945.     If a is true, part1 is executed, if a is false, part 2 is executed.
  946.    if (x>3); message ("x is bigger than 3"); else; message("x is smaller than 3"); end;
  947.  
  948. while (a); [some lines] end;
  949.     If a is true the program executes the lines and when it reaches the end statement, loops back to the while statement, thus the lines may be executed many times, as the program loops in the while statement.
  950.     while (x<100); x:=x+1; end;
  951.  
  952. stop
  953.     Stops program execution;
  954.  
  955. 7.13. Real-value
  956.  
  957. abs (a)
  958.     The absolute value of a.
  959.     abs (-3) = 3.
  960.  
  961. arit(a, b, c)
  962.     The sum of the arithmetic series whose first term is a, second term is b and last term is c.
  963.      arit (1, 4, 16) = 1 + 4 + 7 + 10 + 13 + 16 = 51.
  964.  
  965. ceil (a)
  966.     The smallest integer that is bigger than or equal to a. 
  967.     ceil (╣) = 4.
  968.  
  969. geom (a, b, c)
  970.     The sum of the geometric series whose first term is a, second term is b and last term is c.
  971.     geom (1, 2, 16) = 1 + 2 + 4 + 8 + 16 = 31.
  972.  
  973. int (a)
  974.     The largest number smaller than a.
  975.     int (3.5) = 3.
  976.  
  977. inv (a)
  978.     The inverse value of a.
  979.     inv (2) = 1/2 = 0.5.
  980.  
  981. limit(limit1, x, limit2)
  982.     If x lies between limit1 and limit2 this function will return x. If x is greater than the greater of the two limits, the function will return that limit. If x is smaller than the smaller of the two limits, the function will return that limit. This function is useful if you want to constrain a variable to a certain range. x := limit(0, x, 100).
  983.  
  984. max (a, b)
  985.     The greatest of the values a and b.
  986.  
  987. min (a, b)
  988.     The smallest of the values a and b.
  989.  
  990. pi or ╣
  991.     Constant that equals the ratio of the circumference of a circle to its diameter. pi ┼ 3.141╔
  992.  
  993. rnd
  994.     A random value between 0 and 1.
  995.  
  996. round (a, b)
  997.     a rounded off at the b:th decimal place.
  998.     round (╣, 2) = 3.14.
  999.  
  1000. sgn (a)
  1001.     The sign of a. -1 if a < 0, +1 if a >0.
  1002.     sgn (-3) = -1.
  1003.     The sgn function is normally not defined for 0, but for the sake of convenience, this program will use: sgn(0) = 1.
  1004.  
  1005. 7.14. Sign functions
  1006.  
  1007. a + b, a - b, a * b, a / b
  1008.     Ordinary addition, subtraction multiplication and division.
  1009.  
  1010. a % b
  1011.     a modulus b, the rest you get when you divide a by b.
  1012.     10 % 7 = 3.
  1013.  
  1014. a \ b
  1015.     The integer part of the quotient a / b.
  1016.     10 \ 3 = 3.
  1017.  
  1018. a ^ b
  1019.     a raised to the power of b.
  1020.     2 ^ 3 = 8.
  1021.  
  1022. ├ a
  1023.     The square root of a.
  1024.     ├ 9 = 3.
  1025.  
  1026. a!
  1027.     The permutation of a.
  1028.     4! = 1 * 2 * 3 * 4 = 24.
  1029.  
  1030. a < b, a > b, a <= b, a ▓ b, a >= b, a │ b, a <> b, a >< b
  1031.     Comparing functions, has the numerical value 1 if the condition is satisfied, 0 otherwise. <= means "less than or equal to". <> and >< means "not equal to".
  1032.     (1 < 3) = 1, (2 <= 2) = 1, (3 <> 3) = 0, (2 = 1) = 0
  1033.  
  1034. variable := b
  1035.     Assigns the value b to the variable a.
  1036.     x := 3, assigns the value 3 to the variable x.
  1037.  
  1038. ( )
  1039.    Parentheses are used to separate parts of the calculation.
  1040.     3 * (2 + 3) = 15.
  1041.  
  1042. e
  1043.     Constant, the base of the natural logarithm.
  1044.     e ┼ 2.718╔
  1045.  
  1046.     Constant, the ratio of the circumference of a circle to its diameter.
  1047.     ╣ ┼ 3.141╔
  1048.  
  1049. E
  1050.     Exponent, used when displaying numbers in scientific notation.
  1051.     2.3E+4 = 23000.
  1052.     Note that E should be thought of as a part of the number, and not as a function. That is, you cannot write 3E+x or 3E+(4+3). In these cases you must write 3*10^x and 3*10^(4+3), respectively.
  1053.  
  1054. ,
  1055.     Used for separating arguments to a function.
  1056.     FRect (0, 0, 100, 100).
  1057.  
  1058. ;
  1059.    Used for ending a statement when programming.
  1060.    x := 3;
  1061.  
  1062. 7.15. Time functions
  1063.  
  1064. tick
  1065.     The number of ticks (1/60ths of a second) since the system was last started up. The ticks can be used for timing by noticing the difference between the values returned by two different calls to tick.
  1066.  
  1067. 7.16. Trigonometric
  1068.  
  1069. sin (x)
  1070.     The sine value of x (in radians).
  1071.  
  1072. cos (x)
  1073.     The cosine value of x.
  1074.  
  1075. tan (x)
  1076.     The tangent value of x. tan (x) = sin (x) / cos (x).
  1077.  
  1078. cot (x)
  1079.     The cotangent value of x. cot (x) = 1 / tan (x).
  1080.  
  1081. sec (x)
  1082.     The secant value of x. sec (x) = 1 / cos (x).
  1083.  
  1084. csc (x)
  1085.     The cosecant value of x. csc (x) = 1 / sin (x).
  1086.  
  1087. asin (x)
  1088.     The arcsine value of x. sin (asin (x)) = x.
  1089.  
  1090. acos (x)
  1091.     The arccosine value of x. cos (acos (x)) = x.
  1092.  
  1093. atan (x)
  1094.     The arctangens value of x. tan (atan (x)) = x.
  1095.  
  1096. acot (x)
  1097.     The arccotangent value of x. acot (cot (x)) = x.
  1098.  
  1099. asec (x)
  1100.     The arcsecant value of x. sec ( asec (x)) = x.
  1101.  
  1102. acsc (x)
  1103.     The arccosecant value of x. csc ( acsc (x)) = x.
  1104.  
  1105. sinh (x)
  1106.     The hyperbolical sine of x.
  1107.  
  1108. cosh (x)
  1109.     The hyperbolical cosine of x.
  1110.  
  1111. tanh (x)
  1112.     The hyperbolical tangent of x. tanh (x) = sinh (x) / cosh (x).
  1113.  
  1114. deg (x)
  1115.     The number of degrees corresponding to x radians.
  1116.     deg (╣/2) = 90.
  1117.  
  1118. rad (x)
  1119.     The number of radians corresponding to x degrees.
  1120.     rad (90) = ╣/2.
  1121.  
  1122. 7.17. Window functions
  1123.  
  1124. Window("Title", left, top, right, bottom, windowProc)
  1125.     Opens a window with the specified title and coordinates. The windowProc determines which type of window will be opened. It should be one of the following:
  1126.     00 - document window
  1127.     01 - dialog box 
  1128.     02 - plain dialog box
  1129.     03 - alternative dialog box
  1130.     04 - document without grow box
  1131.     08 - document with zoom box
  1132.     12 - document with zoom box but without grow box
  1133.     16 - black title bar, rounded corner window
  1134.  
  1135. Close
  1136.     Closes the program's drawing window.
  1137.  
  1138. Copy
  1139.     This command will copy everything that has been drawn by the program since the last call to Copy and put the result in the clipboard. It can then be pasted to the Scrap Book or to a word processing program. This is useful if you have used the calculator to create some appealing graphics.
  1140.  
  1141. 8. Formulas
  1142.  
  1143. This section of the manual contains a variety of formulas from mathematics, physics, chemistry, &c╔ It is of course not possible to cover every formula and every topic, but I have tried to include the information I found most useful. The formulas are designed to be used together with the Extended Calculator, so they are written in the calculators native language. If there are functions in these formulas that you do not understand I refer to the functions part of this manual, where all functions supported by the calculator are described.
  1144.  
  1145. To use these formulas together with the calculator, select the formula that you need and copy it to the Extended Calculator, then replace the text in the formula with the known values.
  1146.  
  1147. 8.1. Mathematics
  1148.  
  1149. Mathematical symbols used in this section:
  1150.  
  1151. +        Addition
  1152. -        Subtraction
  1153. *        Multiplication
  1154. / : ╓    Division (any of these will do)
  1155. ├        Square root
  1156. ^        Power
  1157. !        Permutation
  1158. \        Integer division
  1159. %        Modulus
  1160. &&       Logical and
  1161. &        Bitwise and
  1162. ||       Logical or
  1163. |        Bitwise or
  1164. >        Greater than
  1165. <        Smaller than
  1166. =        Equal to
  1167. │ >=     Greater than or equal to
  1168. ▓ <=     Smaller than or equal to
  1169. ¡ <>     Not equal to
  1170. <=>      Equivalence
  1171. =>       Implicates
  1172.  
  1173. 8.1.1 Fundamental algebraic laws
  1174.  
  1175. a + b = b + a
  1176. a * b = b * a
  1177. (a + b) + c = a + (b + c)
  1178. (a * b) * c = a * b * c
  1179. a * (b + c) = a * b + a * c
  1180. a + c = b + c <=> a = b
  1181. a * c = b * c <=> a = b if c ¡ 0
  1182.  
  1183. 8.1.2 Approximations
  1184.  
  1185. Ñ The error in an approximation is the difference between the approximation and the real value.
  1186. Ñ A number f is said to be an error approximation if the absolute value of the error is less than or equal to f.
  1187. Ñ The relative error is the quotient of the error and the approximation.
  1188. Ñ The relative error approximation is the quotient of the error approximation and the approximation.
  1189. Ñ When adding or subtracting two approximations, the error in the result is not greater than the sum of the errors in the approximation.
  1190. Ñ When multiplying an approximation with a constant, the error in the result is not greater than the error in the approximation multiplied by the constant.
  1191. Ñ When multiplying or dividing two approximations, the relative error in the result is approximately equal to the sum of the relative error approximations.
  1192. Ñ Some useful approximations for small values of x are:
  1193.    1/(1 + x) ┼ 1 - x
  1194.    ├(1 + x)  ┼ 1 + x/2
  1195.    sin x     ┼ x
  1196.  
  1197. 8.1.3 Algebra
  1198.  
  1199. 8.1.3.1 Quadratic laws, binomial theorem
  1200.  
  1201. (a + b)^2 = a^2 + 2ab + b^2
  1202. (a - b)^2 = a^2 + 2ab + b^2
  1203. (a - b) (a + b) = a^2 - b^2
  1204. a^3 + b^3 = (a + b)(a^2 - ab + b^2)
  1205. a^3 - b^3 = (a - b) (a^2 + ab + b^2)
  1206. (a + b)^n = com(0,n) a^n b^0 + com(1, n) a^(n-1) b^1 + com(2, n) a^(n-2) b^2 + ╔ + com(n,n) a^0 b^n
  1207.  
  1208. 8.1.3.2 Solving Quadratic Equations
  1209.  
  1210. The roots to the equation ax^2 + bx + c, are given by:
  1211.     (-b + ├(b^2 - 4ac))/2a        and
  1212.     (-b - ├(b^2 - 4ac)/2a
  1213.  
  1214. 8.1.3.3 Fundamental Theorem of Algebra
  1215.  
  1216. If P(x) is a polynomial, then
  1217.     P(x) = (x - a) Q(x) + P(a)
  1218. Where Q(x) is a polynomial whose degree is one less than the degree of P(x).
  1219. Thus if P(a) = 0, P(x) is dividable by (x - a).
  1220.  
  1221. 8.1.4 Logarithms and Exponents
  1222.  
  1223. 8.1.4.1 Laws for Exponents
  1224.  
  1225. a^0 = 1
  1226. a^(inv(N)) = the Nth root of a
  1227. a^(-x) = inv (a^x)
  1228. a^x a^y = a^(x + y)
  1229. a^x / a^y = a^(x - y)
  1230. (a^x)^y = a^(xy) = (a^y)^x
  1231. a^x b^x = (ab)^x
  1232.  
  1233. 8.1.4.2 Definition of Logarithms
  1234.  
  1235. y = 10^x <=> x = log (10,y) = lg y
  1236. y = a^x <=> x = log (a, y)
  1237. y = e^x <=> x = ln y
  1238. ln y = ln 10 lg y
  1239. lg y = lg e ln y
  1240.  
  1241. 8.1.4.3 Logarithm Laws
  1242.  
  1243. log(c,x) + log(c,y) = log(c,xy)
  1244. log(c,x) - log(c,y) = log(c,x/y)
  1245. log(c,x^p) = p log(c, x)
  1246. log(a,x) = log(c,x)/log(c,a)
  1247.  
  1248. 8.1.5 Analytical geometry
  1249.  
  1250. 8.1.5.1 Midpoints
  1251.  
  1252. The midpoint of (a,b) - (x,y):
  1253.     ((a + x)/2, (b + y)/2)
  1254.  
  1255. The centre of a triangle (a,b), (c,d), (x,y):
  1256.     ((a + c + x)/3, (b + d + y)/3)
  1257.  
  1258. 8.1.5.2 Distances
  1259.  
  1260. The distance between the points (a,b) and (x,y):
  1261.     ├((a - x)^2 + (b - y)^2)
  1262.  
  1263. The distance from the point (d,e) to the line ax + by + c = 0:
  1264.     abs(ad + be + c)/├(a^2 + b^2)
  1265.  
  1266. The distance from the point (e,f,g) to the plane ax + by + cz + d = 0 is given by:
  1267.     abs(ae + bf + cg + d)/├(a^2 + b^2 + c^2)
  1268.  
  1269. 8.1.5.3 Scalar Product
  1270.  
  1271. The scalar product of the vectors (a, b) and (x, y):
  1272.     ax + by
  1273.       or
  1274.     the length of the vectors multiplied by the cosine of the angle between the vectors.
  1275.  
  1276. The scalar product of (a, b, c) and (x, y, z) is:
  1277.    ax + by + cz
  1278.  
  1279. 8.1.5.4 Vector length
  1280.  
  1281. The length of the vector (x,y):
  1282.     ├(x^2 + y^2)
  1283.  
  1284. The length of the vector (x,y,z):
  1285.     ├(x^2 + y^2 + z^2)
  1286.  
  1287. 8.1.5.5 Angle between vectors
  1288.  
  1289. Cosine of the angle between the vectors (a,b) and (x,y):
  1290.  
  1291.     the scalar product of the vectors divided by the product of the vectors' lengths, that is:
  1292.  
  1293.     (ax + by) / (├(a^2 + b^2) ├(x^2 + y^2))
  1294.  
  1295. The same holds in three dimensions, for the angle º between (a, b, c) and (x, y, z) we have:
  1296.  
  1297.     cos º = (ax + by + cz) / (├(a^2 + b^2 + c^2) ├(x^2 + y^2 + z^2))
  1298.     
  1299. 8.1.5.6 Straight Lines
  1300.  
  1301. The line between (a,b) and (c,d) has the equation:
  1302.     y - b = ((d - b)/(c - a))(x - a)
  1303.  
  1304. A straight line can be written on the form:
  1305.     y = kx + m
  1306.  
  1307. A line through the point (a,b) parallel to the vector _v_ = (c, d) has the equation:
  1308.     (x, y) = (a, b) + t(c, d)
  1309.  
  1310. A line through the point (a, b, c) parallel to the vector _v_ = (d, e, f) has the equation:
  1311.     (x, y, z) = (a, b, c) + t(d, e, f).
  1312.  
  1313. 8.1.6 Calculus
  1314.  
  1315. 8.1.6.1 Increasing/Decreasing Functions
  1316.  
  1317. A function is on an interval I
  1318.   increasing if a > b => f(a) > f(b)
  1319.   decreasing if a > b => f(a) < f(b)
  1320. for all values of a and b in the interval I
  1321.  
  1322. 8.1.6.2 Local maximum and minimum
  1323.  
  1324. A function has in the point x
  1325.   a local maximum if f(a)<f(x)
  1326.   a local minimum if f(a)>f(x)
  1327. for all points a sufficiently close to x
  1328.  
  1329. 8.1.6.3 Derivative of Function
  1330.  
  1331. The derivative of a function f(x) is defined by:
  1332.     limes when h -> 0 of (f(x + h) - f(x))/h
  1333.  
  1334. 8.1.6.4 Finding Maximum and Minimum
  1335.  
  1336. A function is increasing if f'(x)>0 and decreasing if f'(x)<0.
  1337.  
  1338. If f'(a) = 0 and the sign shift close to a is
  1339.     + 0 -, then f(a) is a local maximum
  1340.     - 0 +, then f(a) is a local minimum
  1341.     + 0 +, then f(a) is a terrace point
  1342.     - 0 -, then f(a) is a terrace point
  1343.  
  1344. If f'(a) = 0 and f''(a)>0 then f(a) is a local maximum.
  1345. If f'(a) = 0 and f''(a)<0 then f(a) is a local minimum.
  1346.  
  1347. 8.1.6.5 Determining concavity
  1348.  
  1349. If f''(a)>0 the function is convex in the point a.
  1350. If f''(a)<0 the function is concave in the point a.
  1351. If f''(a) = 0 and if f''(x) in the vicinity of a shifts sign as - 0 + or + 0 -, then a is an inflection point of the curve.
  1352.  
  1353. 8.1.6.6 Mean Value Theorem
  1354.  
  1355. If f is differentiable in the interval [a,b]╩then there exists a c, such that:
  1356.     f(b) - f(a) = (b - a) f(c)
  1357.  
  1358. 8.1.7 Rules of Differentiation
  1359.  
  1360. 8.1.7.1 Arithmetic Operations
  1361.  
  1362. If f(x) and g(x) are differentiable then:
  1363. - - - - - - - - - - - - - - - - - - - - -
  1364. h(x) = f(x) + g(x) => h'(x) = f'(x) + g'(x)
  1365. h(x) = f(x) * g(x) => h'(x) = f(x)g'(x) + f'(x)g(x)
  1366. h(x) = f(x) / g(x) => h'(x) = (f'(x)g(x) - f(x)g'(x))/(g(x)^2)
  1367. h(x) = f(g(x)) => h'(x) = f'(g(x))g'(x)
  1368.  
  1369. 8.1.7.2 Common derivatives
  1370.  
  1371. Function   Derivative
  1372. --------------------------
  1373. x^n        nx^(n-1)
  1374. 1/x        -1/(x^2)
  1375. ├x         1/(2├x)
  1376. sin x      cos x
  1377. cos x      - sin x
  1378. tan x      1/(cos(x)^2)
  1379. cot x      -1/(sin(x)^2)
  1380. e^x        e^x
  1381. a^x        a^x ln a, when a>0
  1382. log(a,x)   1/(x ln a), when a, x > 0, a ¡ 1
  1383. ln x       1/x, when x > 0
  1384. asin x     1/(├(1 - x^2))
  1385. atan x     1/(1 + x^2)
  1386.  
  1387. 8.1.8 Integrals
  1388.  
  1389. 8.1.8.1 Primitive functions
  1390.  
  1391. F(x) is a primitive function to f(x) on an interval if
  1392.     F'(x) = f(x) on the interval.
  1393.  
  1394. An indefinite integral can be written ║f(x) dx = F(x) + C.
  1395.  
  1396. 8.1.8.2 Rules of Integration
  1397.  
  1398. a║b f(x) dx = F(b) - F(a)
  1399. a║b f(x) dx = a║c f(x) dx + c║b f(x) dx
  1400. a║b [f(x) + g(x)] dx = a║b f(x) dx + a║b g(x) dx
  1401. a║b k f(x) dx = k a║b f(x) dx
  1402.  
  1403. 8.1.8.3 Common Integration Methods
  1404.  
  1405. Partial integration
  1406. -------------------
  1407. ║f'g dx = fg - ║fg' dx
  1408.  
  1409. Substitution
  1410. ------------
  1411. a║b f(g(x))g'(x) dx = g(a)║g(b) f(t) dt
  1412.  
  1413. 8.1.8.4 Some primitive functions
  1414.  
  1415. Function              Primitive function
  1416. -----------------------------------
  1417. k                     kx
  1418. x^n                   x^(n+1)/(n+1)
  1419. 1/x                   ln |x|
  1420. e^x                   e^x
  1421. a^x                   a^x/ln a
  1422. 1/(x - a)             ln (abs(x - a))
  1423. 1/(x - a)(x - b)      1/(a - b) ln((x - a)/(x - b))
  1424. 1/(x - a)^2           -1/(x - a)
  1425. 1/(x^2 + a^2)         1/a atan(x/a)
  1426. x/(x^2 + a^2)         1/2 ln (x^2 + a^2)
  1427. ├(x^2 + a^2)          x/2 ├(x^2 + a^2) + a^2/2 ln (x + ├(x^2 + a^2))
  1428. ├(x^2 - a^2)          x/2 ├(x^2 - a^2) - a^2/2 ln (abs(x + ├(x^2 - a^2)))
  1429. 1/├(x^2 + a^2)        ln(x + ├(x^2 + a^2))
  1430. 1/├(x^2 - a^2)        ln(abs(x + ├(x^2 - a^2)))
  1431. 1/├(a^2 - x^2)        asin(x/a)
  1432. sin x                 -cos x
  1433. (sin x)^2             1/2(x - sin x cos x)
  1434. 1/sin x               ln(abs(tan(x/2)))
  1435. 1/(sin x)^2           -cot x
  1436. cos x                 sin x
  1437. 1/cos x               ln(abs(tan(x/2 + ╣/4)))
  1438. 1/(cos x)^2           tan x
  1439. tan x                 - ln(abs(cos x))
  1440.  
  1441. 8.1.9 Conics
  1442.  
  1443. Circle with midpoint in (p, q) and radius r
  1444.    (x - p)^2 + (y - q)^2 = r^2
  1445.  
  1446. Parabola with vertex in origin and focus in (c,0)
  1447.    y^2 = 4cx
  1448.  
  1449. Ellipse with midpoint in origin and foci in (c,0) and (-c,0)
  1450.     x^2/a^2 + y^2/b^2 = 1, where a^2 - b^2 = c^2
  1451.  
  1452. Hyperbola with midpoint in origin and foci in (c,0) and (-c, 0)
  1453.     x^2/a^2 - y^2/b^2 = 1, where a^2 + b^2 = c^2
  1454.  
  1455. The asymptotes of the hyperbola are given by
  1456.     y = bx/a and y = -bx/a
  1457.  
  1458. 8.1.10 Differential equations
  1459. 
  1460. A differential equation is an equation involving derivatives. A differential equation of the form
  1461.  
  1462.     f(y, y', y'', ╔) = 0
  1463.  
  1464. is called a homogenous differential equation. The general solution of a differential equation of the form
  1465.  
  1466.    f(y, y', y'', ╔) = g(x)
  1467.  
  1468. is given by adding a function which solves the equation (a particular solution) to the general solution of the corresponding homogenous equation.
  1469.  
  1470. 8.1.10.1 First order
  1471.  
  1472. y' + ay = 0 has the solution:
  1473.    y(x) = Ce^(-ax)
  1474.    where C is an arbitrary constant
  1475.  
  1476. y' + ay = b has the solution:
  1477.    y(x) = b/a + Ce^(-ax)
  1478.  
  1479. y' + ay = f(x) has the solution:
  1480.    y(x) = e^(-ax)(C + ║e^(ax)f(x) dx)
  1481.  
  1482. y' + y f(x) = g(x) has the solution:
  1483.    y(x) = (G(x) + C)e^(-F(x))
  1484.    where F(x) is a primitive function to f(x) and G(x) is a primitive function to g(x)e^F(x)
  1485.  
  1486. 8.1.10.2 Second order
  1487.  
  1488. y'' + ay' + by = 0
  1489.    has the characteristic equation
  1490. h^2 + ah + b = 0
  1491.    with the roots h1 and h2
  1492.  
  1493. Ñ╩If h1 and h2 are real numbers, such that h1 ¡ h2, then the solution is given by:
  1494.    y(x) = C1e^(h1x) + C2e^(h2x)
  1495. Ñ If h1 and h2 are real numbers, such that h1 = h2, then the solution is given by:
  1496.    y(x) = e^(h1x)(C1x + C2)
  1497. Ñ If the function lacks real roots, the solution is given by:
  1498.    y(x) = e^(-1/2 ax)(C1 cos kx + C2 sin kx)
  1499.    where k = ├(-a^2/4 + b)
  1500.  
  1501. 8.1.11 Geometry
  1502.  
  1503. 8.1.11.1 Parallelogram 
  1504.  
  1505. Sides a and b and height against a, h
  1506. Area = ah
  1507. Diagonals c and d, c^2 + d^2 = 2a^2 + 2b^2
  1508.  
  1509. 8.1.11.2 Parallel trapezium
  1510.  
  1511. Parallel sides: a and b
  1512. Height: h
  1513. Area = h(a + b)/2
  1514.  
  1515. 8.1.11.3 Circle
  1516.  
  1517. Radius: r
  1518. Diameter = 2r
  1519. Circumference = 2╣r
  1520. Area = ╣r^2
  1521.  
  1522. 8.1.11.4 4 Circle sector
  1523.  
  1524. Radius: r
  1525. Central angle: a rad
  1526. Side = ar
  1527. Area = ar^2/2
  1528.  
  1529. 8.1.11.5 Prism
  1530.  
  1531. Area: B
  1532. Height: h
  1533. Volume = Bh
  1534.  
  1535. 8.1.11.6 Pyramid
  1536.  
  1537. Area: B
  1538. Height: h
  1539. Volume = Bh/3
  1540.  
  1541. 8.1.11.7 Straight circular cylinder
  1542.  
  1543. Radius: r
  1544. Bottom disc area: ╣r^2
  1545. Cylindrical wall area: 2╣rh
  1546. Volume: ╣hr^2
  1547.  
  1548. 8.1.11.8 Straight circular cone
  1549.  
  1550. Radius: r
  1551. Height: h
  1552. Side = ├(r^2 + h^2)
  1553. Surface area = ╣r├(r^2 + h^2)
  1554. Bottom disc area: ╣r^2
  1555. Volume = 1/3 ╣hr^2
  1556.  
  1557. 8.1.11.9 Sphere
  1558.  
  1559. Radius: r
  1560. Area = 4╣r^2
  1561. Volume = 4╣r^3/3
  1562.  
  1563. 8.1.12 Trigonometry
  1564.  
  1565. 8.1.12.1 Pythagoras' theorem
  1566.  
  1567. If the length  of the two perpendicular sides in a right angled are a and b and the length of the hypotenuse is c, the following relationship holds:
  1568.     a^2 + b^2 = c^2
  1569.  
  1570. 8.1.12.2 Definitions
  1571. 
  1572. Unit circle
  1573. -----------
  1574. Let c be a circle with centre in the origin and radius 1. Let r be a radius in the circle which makes angle º with the positive x-axis (positive angles are measured counter-clockwise). Let (x,y) be the point of intersection between r and c, we then have
  1575.     sin º = y
  1576.     cos º = x
  1577.  
  1578. Triangle
  1579. --------
  1580. In a right angled triangle, the sine of an angle is the length of the opposite side divided by the hypotenuse. The cosine of the angle is length of the adjacent side divided by the hypotenuse.
  1581.  
  1582. Other trigonometric functions
  1583. -----------------------------
  1584. tan º╩= sin º / cos º
  1585. cot º = cos º / sin º
  1586. sec º = 1 / cos º
  1587. csc º = 1 / sin º
  1588.  
  1589. 8.1.12.3 The Triangle
  1590.  
  1591. Let a, b, c be the sides of a triangle and A, B, C be the angles facing the corresponding sides. Let T be the are of the triangle. We then have:
  1592.  
  1593. (The sine theorem)
  1594.     sin A/a = sin B/b = sin C/c
  1595.  
  1596. (The cosine theorem)
  1597.     a^2 = b^2 + c^2 - 2bc cos A
  1598.  
  1599. (The area theorem)
  1600.     T = ab/2 sin C
  1601.  
  1602. 8.1.12.4 Trigonometric Identities
  1603.  
  1604. (sin º)^2 + (cos º)^2 = 1
  1605.  
  1606. sin (º + ╢) = sin º cos ╢ + sin ╢ cos º
  1607. sin (º - ╢) = sin º cos ╢ - sin ╢ cos º
  1608. cos (º + ╢) = cos╩º cos ╢ - sin º sin╩╢
  1609. cos (º - ╢) = cos º cos ╢ + sin º sin ╢
  1610.  
  1611. tan (º + ╢) = (tan º + tan ╢)/(1 - tan╩º tan ╢)
  1612. tan (º - ╢) = (tan º - tan ╢)/(1 + tan╩º tan ╢)
  1613.  
  1614. sin º + sin ╢ = 2 sin((º + ╢)/2) cos((º - ╢)/2)
  1615. sin º - sin ╢ = 2 cos((º + ╢)/2) sin((º - ╢)/2)
  1616. cos º + cos ╢ = 2 cos((º + ╢)/2) cos((º - ╢)/2)
  1617. cos º - cos ╢ = -2 sin((º╩+ ╢)/2) sin((º - ╢)/2)
  1618.  
  1619. sin 2º = 2 sin º cos º
  1620. cos 2º = (cos º)^2 - (sin º)^2
  1621.        = 2 (cos º)^2 - 1
  1622.        = 1 - 2 (sin º)^2
  1623. tan 2º = 2 tan º/(1 - (tan º)^2)
  1624.  
  1625. sin 3º = 3 sin º - 4(sin º)^3
  1626. cos 3º = 4(cos º)^3 - 3 cos º
  1627.  
  1628. (sin (º/2))^2 = (1 - cos º)/2
  1629. (cos (º/2))^2 = (1 + cos º)/2
  1630.  
  1631. 8.1.13 Sequences and series
  1632.  
  1633. 8.1.13.1 Arithmetic sequence
  1634.  
  1635. In an arithmetic sequence the difference between a number and the next a constant, if the first number is a and the difference d, the sequence looks like:
  1636.  
  1637.    a, a + d, a + 2d, a + 3d, a + 4d, a + 5d╔
  1638.  
  1639. The sum of an arithmetic series is given by:
  1640.  
  1641.    s = t1 + t2 + ╔ + tn = n (t1 + tn)/2
  1642.  
  1643. 8.1.13.2 Geometric sequence
  1644.  
  1645. In a geometric sequence the quotient between a number and the next is a constant. If the first number is a and the quotient k the sequence looks like:
  1646.  
  1647.    a, ak, ak^2, ak^3, ak^4, ak^5╔
  1648.  
  1649. The sum of a geometric sequence is given by:
  1650.  
  1651.    s = a + ak + ak^2 + ╔ + ak^(n-1) = a(k^n - 1)/(k - 1)
  1652. (Provided that k ¡1)
  1653.  
  1654. 8.1.13.3 Convergence
  1655.  
  1656. A series is said to be convergent if the sums of the n first terms has a limit as n approaches infinity.
  1657.  
  1658. A geometric series is convergent if -1 < k < 1 and does in that case have the sum s = a/(1 - k).
  1659.  
  1660. 8.1.14 Statistics
  1661.  
  1662. 8.1.14.1 Concepts
  1663.  
  1664. Ñ A statistic material is a number of observations, in this document denoted by x1, x2, x3, x4, ╔ xn.
  1665. Ñ The frequency is the number of times a specific observation has occurred in the material.
  1666. Ñ╩The relative frequency is the quotient of the frequency and the number of observations (n).
  1667. Ñ If the material consists of real numbers it is divided in intervals.
  1668. Ñ╩The accumulated frequency is the number of observations less than or equal to  a certain value.
  1669. Ñ The accumulated relative frequency is the quotient of the accumulated frequency and the number of observations
  1670.  
  1671. 8.1.14.2 Mean, median, mode
  1672.  
  1673. The mean value is given by
  1674. _
  1675. x = (x1 + x2 + x3 + ╔╩+ xn)/n = 1/n ╖ xi
  1676.  
  1677. The median is the value above and below which there are an equal number of values. If the number of observations is even, the median is the mean of the two mid-values.
  1678.  
  1679. The mode is the value that has the highest frequency of the observed values.
  1680.  
  1681. 8.1.14.3 Standard deviation
  1682.  
  1683. The standard deviation is given by:
  1684.  
  1685. s^2 = 1/(n-1) ╖ (xi - m)^2 
  1686.     = 1/n-1 (╖ (xi^2) - (╖ xi)^2/n)
  1687.  
  1688. where m is the mean value.
  1689.  
  1690. 8.1.15 Probability
  1691.  
  1692. 8.1.15.1 Basic Concepts
  1693.  
  1694. If p independent operations can be executed in n1, n2, n3, n4, ╔ np different ways, the total number of possibilities is:
  1695.    N = n1 * n2 * n3 * ╔╩* np
  1696.  
  1697. The number of permutations of n element is given by:
  1698.    n! = 1 * 2 * 3 * ╔╩* n
  1699. By definition, 0! = 1.
  1700.  
  1701. Among n elements, k can be selected in:
  1702.    com(n, k) = n!/(k!(n-k)!) different ways.
  1703.  
  1704. 8.1.15.2 Binomial distribution
  1705.  
  1706. If the chance of success of an experiment is p, the chance that exactly k experiments of n should be successful is:
  1707.  
  1708.     com(n,k) p^k (1-p)^(n-k)
  1709.  
  1710. This is called binomial distribution. For this distribution the expected value u and the standard deviation o are given by:
  1711.    u = np
  1712.    o^2 = npq
  1713.  
  1714. 8.1.15.3 The common frequency function
  1715.  
  1716. The frequency function for the normal distribution with expected value u and standard deviation o is given by:
  1717.  
  1718.    f(x) = 1/(o├(2╣)) e^(-1/2 ((x - u)/o)^2)
  1719.  
  1720. With u = 0 and o = 1, we get the standardized common frequency function
  1721.    f(x) := (1/├2╣) e^(-x^2/2);
  1722.  
  1723. 8.1.15.4 Interval of confidence
  1724.  
  1725. From a normal distributed population with the mean value u and the standard deviation o an arbitrary sample of n elements and mean value x is taken. The following condition then holds with 95 % probability
  1726.  
  1727.    x - 1.96 o/├n ▓ u ▓╩x + 1.96 o/├n
  1728.  
  1729. If 1.96 is changed to 2.58 the condition holds with 99 % probability.
  1730.  
  1731. 8.2. Physics
  1732.  
  1733. 8.2.1 Physical constants
  1734.  
  1735. Gravitational acceleration....... 9.8 m/s^2
  1736. Gas constant..................... 8.314 J/(mol K)
  1737. Atomic mass unit (u)............. 1.661E-27 kg = (931.5 MeV)
  1738. Neutron rest mass................ 1.0087 u
  1739. Proton rest mass................. 1.0073 u
  1740. Electron rest mass............... 0.0005486 u
  1741. Electron charge.................. 1.602E-19 As
  1742. Avogadro's number................ 6.022E23
  1743. 1 electron volt.................. 1.602E-19 J
  1744. Permittivity of free space....... 8.854E-12 F/m
  1745. Permeability of free space........ 4╣*1E-7 H/m
  1746. Speed of light in vacuum......... 2.997972E8 m/s
  1747. Gravitational constant........... 6.672E-11 Nm^2/kg^2
  1748. Planck's constant................ 6.626E-34 Js
  1749. Boltzmann's constant............. 1.381E-23 JK
  1750. Rydberg's constant............... 1.097E7 m^-1
  1751. Absolute zero.................... -273.15 íC.
  1752.  
  1753. 8.2.2 Mechanics
  1754.  
  1755. The following symbols will be used in this section:
  1756.  
  1757.    m  = mass
  1758.    A  = area
  1759.    V  = volume
  1760.    s  = distance
  1761.    v  = velocity
  1762.    v0 = initial velocity
  1763.    t  = time
  1764.    a  = acceleration
  1765.    g  = acceleration in free fall
  1766.    F  = force
  1767.    M  = moment
  1768.    I  = impulse
  1769.    W  = work
  1770.    P  = power
  1771.  
  1772. 8.2.2.1 Density
  1773.  
  1774. The density r is given by:
  1775.  
  1776.    r = m/V
  1777.  
  1778. 8.2.2.2 Pressure
  1779.  
  1780. The pressure p by a force F on a surface of area A is given by
  1781.  
  1782.    p = F/A
  1783.  
  1784. The pressure p on the depth h in a fluid with density r is given by:
  1785.  
  1786.    p = hgr
  1787.  
  1788. 8.2.2.3 Velocity, acceleration
  1789.  
  1790. The average velocity, and the average acceleration:
  1791.  
  1792.    v = s/t
  1793.    a = v/t
  1794.  
  1795. The instantaneous velocity and acceleration:
  1796.  
  1797.   v = ds/dt
  1798.   a = dv/dt
  1799.  
  1800. 8.2.2.4 Movement with constant acceleration
  1801.  
  1802.    v = v0 + at
  1803.    s = v0t + at^2/2
  1804.    v^2 - v0^2 = 2as
  1805.  
  1806. 8.2.2.5 Newton's second law of motion
  1807.  
  1808.    F = ma
  1809.  
  1810. 8.2.2.6 Moment
  1811.  
  1812.    M = Fr
  1813.  
  1814. r is the perpendicular distance from the axis of revolution to the directional line of the force.
  1815.  
  1816. At equilibrium we have:
  1817.  
  1818.   ╖ M = 0
  1819.  
  1820. 8.2.2.7 Newton's law of gravitation
  1821.  
  1822.    F = GmM/r^2
  1823.  
  1824. m and M are the masses of the two bodies. r is the distance between them. G is the gravitational constant.
  1825.  
  1826.    G = 6.672E-11 Nm^2/kg^2
  1827.  
  1828. 8.2.2.8 Friction
  1829.  
  1830.    F = uN
  1831.  
  1832.  u = frictional coefficient
  1833.  N = normal force
  1834.  
  1835. 8.2.2.9 Throwing parabola
  1836.  
  1837.  º = angle of elevation
  1838.  vx = speed in x-direction
  1839.  vy = speed in y-direction
  1840.  
  1841.    vx = v0 cos º
  1842.    vy = v0 sin º - gt
  1843.  
  1844.    x = v0t cos º
  1845.    y = v0t sin º - gt^2/2
  1846.  
  1847. 8.2.2.10 Momentum
  1848.  
  1849. Momentum = mv
  1850. Change in momentum = impulse
  1851. I = Ft = mv - mv0
  1852.  
  1853. 8.2.2.11 Centripetal force
  1854.  
  1855.  r = radius
  1856.  T = period
  1857.  
  1858.    F = mv^2/r = 4╣^2mr/T^2
  1859.  
  1860. 8.2.2.12 Harmonic motion
  1861.  
  1862. Harmonic motion is represented by the differential equation:
  1863.  
  1864.    m d^2s/dt^2 = -ks
  1865.  
  1866. which is solved by:
  1867.  
  1868.    s = A sin (wt + º)
  1869.  
  1870. A and º are constants. w is the angular speed, A is the amplitude and º is the phase angle.
  1871.  
  1872.    w = ├(k/m)
  1873.  
  1874.    T = 2╣├(m/k) (where T is the period)
  1875.  
  1876. For small oscillations in a pendulum, the following holds:
  1877.  
  1878.    T = 2╣├(l/g)
  1879.  
  1880. 8.2.2.13 Work, energy
  1881.  
  1882.    W = Fs   or   W = ║F ds
  1883.  
  1884. (F is the force in the direction of the movement.)
  1885.  
  1886. Potential energy for a body with mass m on the height h above ground level:
  1887.  
  1888.    W = mgh
  1889.  
  1890. Kinetic energy for a body of mass m moving at speed v:
  1891.  
  1892.    W = mv^2/2
  1893.  
  1894. 8.2.2.14 Power
  1895.  
  1896.    P = W/t
  1897.  
  1898. (W is the change in energy during the time t.)
  1899.  
  1900. 8.2.2.15 Straight central collision
  1901.  
  1902.    mv + m'v' = mv0 + m'v0'
  1903.  
  1904. (Preservation of momentum)
  1905. v0 and v0' are the speeds before the collision
  1906. v and v' are the speeds after the collision
  1907.  
  1908.    e = (v' - v)/(v0 - v0')
  1909.  
  1910. (e is the bouncing coefficient)
  1911.  
  1912. With e = 1 we get a completely elastic collision:
  1913.  
  1914.    v' - v = v0 - v0'
  1915.  
  1916. With e = 0 we get a completely inelastic collision:
  1917.  
  1918.    v = (mv0 + m'v0')/(m + m')
  1919.  
  1920. 8.2.2.16 Hookes' law
  1921.  
  1922.    F = ks
  1923.  
  1924. The elongation of a spring is proportional to the pulling force.
  1925.  
  1926. 8.2.3 Proprieties of gases
  1927.  
  1928. The following symbols will be used in this section:
  1929.  
  1930.    T = temperature (in íK)
  1931.    p = pressure
  1932.    V = volume
  1933.  
  1934. 8.2.3.1 Boyle's law
  1935.  
  1936.    pV = constant
  1937.  
  1938. (when the temperature is constant)
  1939.  
  1940. 8.2.3.2 Charles' law
  1941.    
  1942.    p = constant * T
  1943.  
  1944. (at constant volume)
  1945.  
  1946. 8.2.3.3 Gay-Lussac's law
  1947.  
  1948.    V = constant * T
  1949.  
  1950. (at constant pressure)
  1951.  
  1952. 8.2.3.4 General gas law
  1953.  
  1954.    pV = nRT
  1955.  
  1956. (n = number of mols, 
  1957.  R = gas constant = 8.314 J/(mol K))
  1958.  
  1959.    r = p/p0 T0/T r0
  1960.  
  1961. (p0 = initial pressure - 101.3 kPa
  1962.  T0 = initial temperature - 273 íK
  1963.  r0 = initial density - density at 101.3 kPa, 273 íK)
  1964.  
  1965. 8.2.3.5 Volume expansion of a gas at constant pressure
  1966.  
  1967.    (V - V0)/(V0 (T - T0)) = 1/273 K^-1
  1968.  
  1969. (T - T0 = change in temperature)
  1970.  
  1971. 8.2.3.6 Dalton's law
  1972.  
  1973.    p = p1 + p2 + ╔
  1974.  
  1975. (p1, p2, ╔ = partial pressures)
  1976.  
  1977. 8.2.3.7 Kinetic gas theory
  1978.  
  1979.  m   = the mass of one molecule of gas
  1980.  N   = the number of molecules
  1981.  [v^2] = the average of the square of the velocities
  1982.  [W] = the average of kinetic energy per molecule
  1983.  r   = density
  1984.  
  1985.    p = 1/3 Nm[v^2]/V
  1986.  
  1987.    pV = 1/3 Nm[v^2] = 2/3 N[W]
  1988.  
  1989.    [v^2] = 3 p/r
  1990.  
  1991.    [W] = 1/2 m[v^2] = 3/2 kT
  1992.  
  1993. (k is Boltzmann's constant = 1.381E-23 J/K
  1994.  k = R/A, where R is the gas constant and A is Avogadro's constant)
  1995.  
  1996. 8.2.4 Theory of heat
  1997.  
  1998. The heat capacity of a body = cm, where c is the specific heat capacity.
  1999.  
  2000. The change in heat energy of a body:
  2001.    dQ = cm dT
  2002.  
  2003. 8.2.5 Electronics I - Electrostatics, direct current
  2004.  
  2005. Symbols used in this section:
  2006.  
  2007.    F  force
  2008.    Q  electric charge
  2009.    I  electric current
  2010.    t  time
  2011.    U  voltage
  2012.    W  work, energy
  2013.    K  electric field
  2014.    C  capacitance
  2015.    R  resistance
  2016.    r  resistivity
  2017.    E  electromotive force, emf
  2018.    P  power
  2019.  
  2020. 8.2.5.1 Coulomb's law
  2021.  
  2022.    F = kqQ/r^2
  2023.  
  2024. The force between two charges q and Q at distance r. In vacuum the constant k is ┼ 8,99E9 Nm^2/(As)^2
  2025.  
  2026. 8.2.5.2 Charge
  2027.  
  2028.    Q = It
  2029.  
  2030. The charge delivered by a current I during the time t.
  2031.  
  2032. 8.2.5.3 Voltage
  2033.  
  2034.    U = W/Q
  2035.  
  2036. The voltage between two points equals the work required to transport a charge from one point to the other, divided by the charge's charge.
  2037.  
  2038.    U = V1 - V2
  2039.  
  2040. The voltage between two points equals the difference in electric potential.
  2041.  
  2042. 8.2.5.4 Electric Field Force
  2043.  
  2044.    K = F/Q
  2045.  
  2046. The field force equals the force on a charge divided by the charge's charge.
  2047.  
  2048. The field force in a homogenous field between two charged parallel planes:
  2049.  
  2050.    K = U/d
  2051.  
  2052. (U = voltage between the planes
  2053.  d = distance between the planes)
  2054.  
  2055. 8.2.5.5 Capacitance
  2056.  
  2057.    C = Q/U
  2058.  
  2059. In the flat capacitor we have:
  2060.  
  2061.    C = e A/d
  2062.  
  2063. (A = the area of one plane
  2064.  d = the distance between the planes
  2065.  e = the permittivity of the material)
  2066.  
  2067.    1/C = 1/C1 + 1/C2 + ╔
  2068.  
  2069. (Connecting capacitors in series.)
  2070.  
  2071.    C = C1 + C2 + ╔
  2072.  
  2073. (Connecting capacitors in parallel.)
  2074.  
  2075. The energy of an electrostatic field:
  2076.  
  2077.    W = 1/2 CU^2 = 1/2 QU = 1/2 Q^2/C
  2078.  
  2079. 8.2.5.6 Resistance
  2080.  
  2081.    R = U/I
  2082.  
  2083. (Ohm's law)
  2084.  
  2085.    R = r l/A
  2086.  
  2087. (The resistance in a wire of length l, cross-sectional area A and resistivity r.)
  2088.  
  2089.    R = R1 + R2 + ╔
  2090.  
  2091. (Connecting resistors in series.)
  2092.  
  2093.    1/R = 1/R1 + 1/R2 + ╔
  2094.  
  2095. (Connecting resistors in parallel.)
  2096.  
  2097.    R = R0(1 + aT)
  2098.  
  2099. (The resistance of a material having resistance R0 at 0 íC at the temperature T íC.
  2100.  a = temperature coefficient.)
  2101.  
  2102. 8.2.5.7 Electrolytic battery
  2103.  
  2104.    m = 1/F M/n It
  2105.  
  2106. (m = mass
  2107.  M = molar mass
  2108.  n = ion charge
  2109.  t = time
  2110.  F = Faraday's constant = 96487 As/mol)
  2111.  
  2112. 8.2.5.8 Power and energy
  2113.  
  2114. The power in a wire subject to Ohm's law:
  2115.  
  2116.    P = UI = RI^2 = U^2/R
  2117.  
  2118. The energy developed in the wire during the time t:
  2119.  
  2120.    W = Pt
  2121.  
  2122. 8.2.6 Electronics II Magnetism
  2123.  
  2124. The following symbols are used in this section.
  2125.  
  2126.    B   magnetic flux density
  2127.    v   velocity
  2128.    ─   magnetic flux
  2129.    N   number of wire loops
  2130.    L   inductance
  2131.  
  2132. 8.2.6.1 Magnetic flux density
  2133.  
  2134.    B = constant * f^2
  2135.  
  2136.    f is the frequency of a magnetic material in harmonic motion about an equilibrium
  2137.  
  2138. 8.2.6.2 Laplace's formula
  2139.  
  2140. A conducting element of length ╞l gives an addition ╞B to the flux density B in a point P on the distance r. In vacuum:
  2141.  
  2142.    ╞B = uI sin(a) ╞l/(4╣r^2)
  2143.  
  2144.    a is the angle between the element and a line from the element to P.
  2145.    u = 4╣ * 10^-7 is the permeability of vacuum.
  2146.    I is the current through the conductor.
  2147.  
  2148. The magnetic flux density on distance d of a straight conductor of infinite length in vacuum:
  2149.  
  2150.    B = 2uI/(4╣d)
  2151.  
  2152. The magnetic flux density at the midpoint of a flat circular coil of radius r:
  2153.  
  2154.    B = uNI/(2r)
  2155.  
  2156. The magnetic flux density in a toroid or solenoid
  2157.  
  2158.    B = uNI/l
  2159.  
  2160.    u is the permeability of the material inside the solenoid.
  2161.    l is the length of the solenoid.
  2162.  
  2163. The permeability of air roughly equals the permeability of vacuum.
  2164.  
  2165. 8.2.6.3 Magnetic flux
  2166.  
  2167. With a constant flux density B perpendicular to an area A, the magnetic flux through the area is given by:
  2168.  
  2169.    ─ = BA
  2170.  
  2171. 8.2.6.4 Force between magnetic fields and charges in motion
  2172.  
  2173.    F = IlB
  2174.  
  2175.    l is the length of the conductor in a field perpendicular to the conductor.
  2176.  
  2177.    F = QvB
  2178.  
  2179.    When the charged particle is moving perpendicularly to the field direction.
  2180.  
  2181. 8.2.6.5 Electromagnetic induction
  2182.  
  2183. For the induced current e in a closed circuit where N is the number of loops and ─ is the magnetic flux through the circuit:
  2184.  
  2185.    e = -N d─/dt
  2186.  
  2187. For a conductor of length l moved perpendicularly to a magnetic field of magnetic flux density B, where v is the velocity of the conductor:
  2188.  
  2189.    e = lvB
  2190.  
  2191. For self-induction in a solenoid:
  2192.  
  2193.    e = -L di/dt
  2194.  
  2195.    L is the inductance of the solenoid.
  2196.  
  2197. The energy of a magnetic field inside a solenoid:
  2198.  
  2199.    W = 1/2 Li^2
  2200.  
  2201. 8.2.7 Electronics III. Alternating current.
  2202.  
  2203. (All formulas in this section refer to a sine-shaped current.)
  2204.  
  2205. The following symbols will be used in this section:
  2206.  
  2207.    i, u   momentary current and voltage
  2208.    ö, ₧   amplitudes for current and voltage
  2209.    I, U   effective values for current and voltage
  2210.    w      angular frequency
  2211.    f      frequency
  2212.    t      time
  2213.    P      average power
  2214.    Z      impedance
  2215.  
  2216. 8.2.7.1 Basics
  2217.  
  2218. Momentary values for current and voltage are found by:
  2219.  
  2220.    u = ₧ sin (wt + a)
  2221.    i = ö sin (wt + b)
  2222.  
  2223.    a and b are phase angles
  2224.  
  2225.    w = 2╣f
  2226.    f = 1/T
  2227.  
  2228.    T is the period
  2229.  
  2230.    i = dQ/dt
  2231.  
  2232. For the phase lag of the current and the voltage:
  2233.  
  2234.    ─ = a - b
  2235.  
  2236.    U = ₧/├2
  2237.    I = ö/├2
  2238.  
  2239. With solely resistive load:
  2240.  
  2241.    i = ö sin wt
  2242.    u = ₧ sin wt
  2243.  
  2244.    ö = ₧/R
  2245.  
  2246. With solely inductive load:
  2247.  
  2248.    i = ö sin wt
  2249.    u = ₧ sin (wt + ╣/2)
  2250.    
  2251.    ₧ = wLö
  2252.  
  2253.    wL is the inductive reactance
  2254.  
  2255. With solely capacitive load:
  2256.  
  2257.    i = ö sin wt
  2258.    u = ₧ sin (wt - ╣/2)
  2259.  
  2260.    ₧ = ö/(WC)
  2261.  
  2262.    1/(WC) is the capacitive reactance
  2263.  
  2264. 8.2.7.2 Impedance and phase lag
  2265.  
  2266. Impedance of a load:
  2267.  
  2268.    Z = ₧/ö = U/I
  2269.  
  2270. LRC - circuit in series:
  2271.  
  2272.    Z = ├(R^2 + (wL - 1/(wC)^2)
  2273.  
  2274.    tan ─ = (wL - 1/(wC))/R
  2275.  
  2276. LRC - circuit in parallel
  2277.  
  2278.    Z = 1/(├(1/R^2 + (1/(wL) - wC)^2))
  2279.  
  2280.    tan ─ = R(1/(wL) - wC)
  2281.  
  2282. 8.2.7.3 Resonance
  2283.  
  2284. Resonance in a connection in series of an R, an L and a C component appears when:
  2285.  
  2286.    w = 1/├(LC)
  2287.  
  2288. Then the impedance is given by R.
  2289.  
  2290. 8.2.7.4 Power
  2291.  
  2292. The average power P in a load is given by:
  2293.  
  2294.    P = UI cos ─
  2295.  
  2296. 8.2.7.5 Transformer
  2297.  
  2298. For an ideal transformer we have:
  2299.  
  2300.    u/U = n/N
  2301.    ni = NI
  2302.  
  2303.    n, N   number of loops in primary and secondary coil respectively
  2304.    u, U   effective voltage values across primary and secondary coil
  2305.    i, I   effective current through primary and secondary coil
  2306.  
  2307. 8.2.7.6 Electronic oscillator
  2308.  
  2309. In an electronic oscillator with inductance L, capacitance C and resistance 0, we have:
  2310.  
  2311.    L d^2i/dt^2 + i/C = 0
  2312.  
  2313. This differential equation is satisfied by:
  2314.  
  2315.    i = ö sin wt, where w = 1/├(LC)
  2316.  
  2317.    T = 2╣├(LC)
  2318.  
  2319. 8.2.8 Optics
  2320.  
  2321. The following symbols are used in this section:
  2322.  
  2323.    ─   light flux
  2324.    I   light strength 
  2325.    E   illumination
  2326.    A   area
  2327.    l   distance from light source to illuminated area
  2328.    ë   angle between light and surface normal
  2329.    a   distance from object to mirror or lens
  2330.    b   distance from picture to mirror or lens
  2331.    r   radius of curved surface
  2332.    f   focal length
  2333.    n   index of refraction
  2334.    º   angle of refraction
  2335.    ╢   angle of deviation
  2336.    c   light speed in vacuum
  2337.    v   light speed in a medium
  2338.  
  2339. 8.2.8.1 Photometrics
  2340.  
  2341.    ─ = 4╣I
  2342.  
  2343.    E = ─/A
  2344.  
  2345.    E = I cos ë /l^2
  2346.  
  2347. 8.2.8.2 Spherical mirrors
  2348.  
  2349.    1/a + 1/b + 1/f = 2/r
  2350.  
  2351.    dD = f^2
  2352.  
  2353.    d = distance from object to focus
  2354.    D = distance from picture to focus
  2355.  
  2356. 8.2.8.3 Law of refraction
  2357.  
  2358.    n sin ë = m sin ₧
  2359.  
  2360.    m, ₧ = index of refraction and angle of refraction in the second medium
  2361.  
  2362. 8.2.8.4 Index of refraction
  2363.  
  2364.    n = c/v
  2365.  
  2366. 8.2.8.5 Minimum deviation in prism
  2367.  
  2368. n sin ((º + ╢)/2) = m sin (º/2)
  2369.  
  2370.    º = top angle of prism
  2371.    ╢ = angle of deviation
  2372.    n = index of refraction outside prism
  2373.    m = index of refraction inside prism
  2374.  
  2375. 8.2.8.6 Thin lenses
  2376.  
  2377.    1/a + 1/b = 1/f
  2378.  
  2379.    dD = f^2
  2380.  
  2381.    d = distance from object to object focus
  2382.    D = distance from image to image focus
  2383.  
  2384. 8.2.9 Wave theory
  2385.  
  2386. The following symbols are used in this section:
  2387.  
  2388.    v   speed of propagation
  2389.    f   frequency
  2390.    l   wave length
  2391.    T   period
  2392.    t   time
  2393.  
  2394. 8.2.9.1 Basics
  2395.  
  2396.    v = lf
  2397.  
  2398.    f = 1/T
  2399.  
  2400. 8.2.9.2 Doppler effect
  2401.  
  2402.    f = emitted frequency
  2403.    g = observe frequency
  2404.    c = speed of propagation
  2405.  
  2406. Source at rest, observer approaching with velocity v:
  2407.  
  2408.    g = f(1 + v/c)
  2409.  
  2410. Source at rest, observer withdrawing with velocity v:
  2411.  
  2412.    g = f(1 - v/c)
  2413.  
  2414. Observer at rest, source approaching with speed v:
  2415.  
  2416.    g = f/(1 - v/c)
  2417.  
  2418. Observer at rest, source withdrawing with velocity v:
  2419.  
  2420.    g = f/(1 + v/c)
  2421.  
  2422. 8.2.9.3 Speed of sound
  2423.  
  2424. v = u├(T/273)
  2425.  
  2426.    T = temperature
  2427.    u = speed at T = 273
  2428.  
  2429. 8.2.10 Electromagnetic radiation
  2430.  
  2431. The following symbols are used in this section:
  2432.  
  2433.    M   emissivity
  2434.    T   absolute temperature
  2435.    l   wavelength
  2436.  
  2437. 8.2.10.1 Stefan-Boltzmann's law
  2438.  
  2439.    M = sT^4
  2440.  
  2441.    where s = 56.70 nW/(m^2K^4)
  2442.  
  2443. 8.2.10.2 Wien's displacement law
  2444.  
  2445.    lT = 2898 umK
  2446.  
  2447.    l = wavelength with maximum energy
  2448.  
  2449. 8.2.10.3 Diffraction grating
  2450.  
  2451.    ml = d sin a
  2452.  
  2453.    m = order of interference fringe
  2454.    d = distance between two lines in diffraction grating
  2455.    a = angle of deviation
  2456.  
  2457. 8.2.11 Nuclear physics
  2458.  
  2459. The following symbols are used in this section:
  2460.  
  2461.    h   Planck's constant = 6.626 * 10^-34 Js
  2462.    W   energy
  2463.    f   frequency
  2464.    l   wavelength
  2465.    m   mass
  2466.    v   velocity
  2467.    c   light speed in vacuum
  2468.    U   voltage
  2469.    e   charge of electron
  2470.  
  2471. 8.2.11.1 Planck's law
  2472.  
  2473.    W = hf
  2474.  
  2475. 8.2.11.2 Photoelectric effect
  2476.  
  2477.    hf = W + mv^2/2
  2478.    hf = W + eU
  2479.  
  2480.    W = work of emission
  2481.  
  2482. 8.2.11.3 de Broglie's formula
  2483.  
  2484.    l = h/(mv)
  2485.  
  2486. 8.2.11.4 Radioactive decay
  2487.  
  2488.    N = Me^(-kt)
  2489.  
  2490.    M = original mass
  2491.    N = mass at time t
  2492.    k = a constant
  2493.    e = base of system of natural logarithms, 2.718╔
  2494.  
  2495. 8.2.11.5 Theory of relativity
  2496.  
  2497.    W = mc^2
  2498.  
  2499.    m = M/├(1 - v^2/c^2)
  2500.    l = L├(1 - v^2/c^2)
  2501.  
  2502.    M = mass at rest
  2503.    L = length at rest
  2504.  
  2505. 8.3. Chemistry
  2506.  
  2507. 8.3.1 Chemical equilibrium
  2508.  
  2509. For the chemical equilibrium aA + bB <-> cC + dD, we have
  2510.  
  2511.    [C]^c*[D]^d/([A]^a*[B]^b) = C
  2512.  
  2513. Where C is a constant.
  2514.  
  2515. 8.3.2 Acids and bases
  2516.  
  2517. Acid constant for the acid HA:
  2518.  
  2519.    K = [H30+] * [A-] / [HA]
  2520.  
  2521. Base constant for the base A-:
  2522.  
  2523.    K = [HA] * [OH-] / [A-]
  2524.  
  2525.    pH = -lg[H30+]
  2526.    pOH = -lg[OH-]
  2527.  
  2528.    [H30+] * [OH-] = K ┼ 1E-14 (mol/dm^3)^2
  2529.    pH + pOH = pK ┼ 14
  2530.  
  2531.    K(a) + K(b) = K = 1E-14
  2532.  
  2533.    K(a) = acid constant
  2534.    K(b) = base constant
  2535.  
  2536. 8.4. Economics
  2537. 
  2538. 8.4.1 Interest
  2539.  
  2540. The value of the deposit d with p % interest after t years:
  2541.    d(1 + p/100)^t
  2542.  
  2543. The value of an annual deposit d with p % interest after t years.
  2544.    d((1 + p/100)^t -1)/(p/100)
  2545.  
  2546. A loan l to an interest of p % is paid back with equal amounts in t years. The necessary amount is given by:
  2547.    l((1 + p/100)^t*p/100)/((1 + p/100)^t -1)
  2548.  
  2549. A deposit to an interest of p % will have the value v in t years, the current value is given by:
  2550.    v/(1 + p/100)^t
  2551. 9. Error Codes
  2552.  
  2553. 9.1. Acsc value not defined
  2554.  
  2555.     This error will appear when you try to calculate the arccosecant of a value for which the function is not defined.
  2556.  
  2557. 9.2. Arccosine argument not between -1 and 1
  2558.  
  2559.     This error will appear if you try to calculate acos() of a value that is not between -1 and 1, since acos is only defined for values in the interval [-1, 1]. acos(2).
  2560.  
  2561. 9.3. Arcsine argument not between -1 and 1
  2562.  
  2563.     This error will appear if you try to calculate asin() of a value that is not between -1 and 1, since asin is only defined for values in the interval [-1, 1]. asin(2).
  2564.  
  2565. 9.4. Asec value not defined
  2566.  
  2567.     This error will appear when you try to calculate the arcsecant of a value for which the function is not defined.
  2568.  
  2569. 9.5. Cot value not defined
  2570.  
  2571.     This error will appear when you try to calculate the cotangent of a value for which the function is not defined.
  2572.  
  2573. 9.6. Csc value not defined
  2574.  
  2575.     This error will appear when you try to calculate the cosecant of a value for which the function is not defined.
  2576.  
  2577. 9.7. Division by complex zero
  2578.  
  2579.     This error will appear if you try to make a complex division with a complex zero. (2, 3) /' (0, 0).
  2580.  
  2581. 9.8. Division by zero
  2582.  
  2583.     This error will appear if you try to divide a number by zero. 5 / 0.
  2584.  
  2585. 9.9. Else without if
  2586.  
  2587.     This error will appear if the computer finds an else statement without a preceding if statement, since such expressions are meaningless. 
  2588.  
  2589. 9.10. End without while or if
  2590.  
  2591.     This error will appear if you have used and end statement without a preceding if or while statement, since such expressions are meaningless.
  2592.  
  2593. 9.11. Expression too complex
  2594.  
  2595.     This error will appear in the rare occasion that your expression has become too complex for the computer to understand. Try splitting up a long statement to several smaller statements.
  2596.  
  2597. 9.12. Function lacking arguments
  2598.  
  2599.     This error will appear if you have passed to few arguments to a function for example calling: angle(3); would raise this error, since angle() requires two arguments.
  2600.  
  2601. 9.13. Function name too long
  2602.  
  2603.     This error will appear if you have used a function name which is longer than 30 characters. None of the functions that the calculator recognizes are so long, so this should generally be a typing error.
  2604.  
  2605. 9.14. Function nesting too complex
  2606.  
  2607.     This error will appear if there are too many while statements inside each other. Try breaking up the structure to prevent too deep nesting.
  2608.  
  2609. 9.15. Interrupted by user
  2610.  
  2611.     This error will appear if you interrupt program execution or graph-drawing by pressing the command key together with the period. This is useful if you have written a while statement that fails to terminate.
  2612.  
  2613. 9.16. Invalid arithmetic sum
  2614.  
  2615.     This error will appear if the three arguments sent to the arit() function can't possibly be the first second and last terms of an arithmetic sum. arit(1,0,3) will raise this error.
  2616.  
  2617. 9.17. Invalid geometric sum
  2618.  
  2619.     This error will appear if the three arguments passed to the geom() function can't possibly be the first second and last terms of a geometric sum. geom (1,1,4) will raise this error.
  2620.  
  2621. 9.18. Modulo zero
  2622.  
  2623.     This error will appear if you try to take modulo zero. Writing 4 % 0 will raise this error.
  2624.  
  2625. 9.19. Number or text used where variable is required
  2626.  
  2627.     This error will appear if you have used a number or text where the computer expected a variable. Writing 3 := 5 will raise this error.
  2628.  
  2629. 9.20. Passing non-text arguments to a function which requires text arguments
  2630.  
  2631.     This error will appear when you try to pass a number or a variable to a function that requires text arguments. message(2+3), will raise this error.
  2632.  
  2633. 9.21. Program too long
  2634.  
  2635.     This message means that your program has exceeded the 1000 memory cells that are reserved for program. If this happens there is not much to do, but to realise that your program has become too complex for this humble calculator. If you need to write the program, consider getting a "real" programming language.
  2636.  
  2637. 9.22. Raising negative number to fraction exponents
  2638.  
  2639.     This error will appear if you try to raise a negative number to a fraction exponent, since this is equivalent to trying to take a root of a negative value. (-2) ^ 0.5.
  2640.  
  2641. 9.23. Raising zero to negative exponent
  2642.  
  2643.     This error will appear if you try to raise zero to a negative exponent, since this is equivalent to dividing by zero. 0 ^ -2.
  2644.  
  2645. 9.24. Sec value not defined
  2646.  
  2647.     This error will appear when you try to calculate the secant of a value for which the function is not defined.
  2648.  
  2649. 9.25. Trying to calculate logarithm of negative value or zero
  2650.  
  2651.     This error will appear if you try to calculate the logarithm of a negative value or zero, since logarithms are not defined for these values. log(-1).
  2652.  
  2653. 9.26. Trying to invert zero
  2654.  
  2655.     This error will appear if you try to invert zero. inv(0).
  2656.  
  2657. 9.27. Trying to permute negative value
  2658.  
  2659.     This error will appear if you try to permute a negative value. (-1)!
  2660.  
  2661. 9.28. Trying to read beyond memory
  2662.  
  2663.     This error will appear if you refer to a memory cell other than the 100 that is available, that is, if the argument passed to mem is smaller than 0 or bigger than 99. mem(101).
  2664.  
  2665. 9.29. Trying to take root of negative value
  2666.  
  2667.     This error will appear if you try to take the root of a negative value. ├-1.
  2668.  
  2669. 9.30. Trying to take tangent of odd multiple of ╣/2
  2670.  
  2671.     This error will appear if you try to take tangent of an odd multiple of ╣/2, since tangent is not defined for these values. tan(3╣/2).
  2672.  
  2673. 9.31. Trying to use 1, 0 or a negative number as base for a logarithm
  2674.  
  2675.     This error will appear, because these numbers cannot be used as bases for logarithms.
  2676.  
  2677. 9.32. Unknown character used
  2678.  
  2679.     This error will appear if you have used a character that the calculator doesn't know of, like î, è or Ü, outside a string.
  2680.  
  2681. 9.33. Unknown character combination used
  2682.  
  2683.     This error will appear if you have used characters that the calculator know of, but grouped them in some strange fashion. Writing 3 >* 3 will raise this error.
  2684.  
  2685. 9.34. Unknown function used
  2686.  
  2687.     This error will appear if you have used a function that the calculator doesn't know of, like DrawSphere(). If you get this error check for typing mistakes. Remember that the calculator bothers about the case of a word, so although there is a function FRect(), it will not recognize fRect().
  2688.  
  2689. 9.35. Unrecognized function
  2690.  
  2691.     This error will appear if you have used a function that the computer doesn't recognize, like drawSphere().
  2692.  
  2693. 9.36. Value returned by sinh too large
  2694.  
  2695.     This error will appear if you pass a too big value to sinh.
  2696.  
  2697. 9.37. Value returned by cosh too large
  2698.  
  2699.     This error will appear if you pass a too big value to cosh.
  2700.  
  2701. 10. Technical Information
  2702.  
  2703. 10.1. How the calculator works
  2704.  
  2705. The calculator gets it results from a two step process.
  2706.  
  2707. In the first step the actual text that the user has written is transformed to a stack of entries compiled using reverse polish notation. This step can be called compilation, remembering, though, that the text is not compiled to machine language, but to a simpler form.
  2708.  
  2709. The next step might be called interpretation. The computer then uses the code created by the previous step and executes each function as it encounters it. When the computer reaches the end of the code the program terminates.
  2710.  
  2711. 10.2. Text to reverse polish notation
  2712.  
  2713. In pseudocode (extremely pseudo), this process might look like this:
  2714.  
  2715.  1. Look at each character in the input string
  2716.  
  2717.  2a. If the character is a number
  2718.     (Read the number and push it to the RPN stack.)
  2719.  
  2720.  2b. If the character is a function
  2721.     (Read the function and push it to the command stack. If the previous entries in the command stack are of higher precedence, taking in account of course any parentheses, than this entry,  pop them from the command stack and push them to the RPN stack.)
  2722.  
  2723.  3. Continue until the entire input string has been examined, then pop all entries from the command stack and push them to the RPN stack.
  2724.  
  2725. If the input string is: (3 + 2) * (4 + 6), what will happen is this:
  2726.  
  2727.  1. The computer reads 3 and pushes it to the RPN stack.
  2728.     RPN stack: 3
  2729.     Command stack: 
  2730.  
  2731.  2. The computer reads + (at parentheses-level 1) and pushes it to the command stack, there are no previous entries to be popped.
  2732.     RPN stack: 3
  2733.     Command stack: +(1)
  2734.  
  2735.  3. The computer reads 2 and pushes it to the RPN stack.
  2736.     RPN stack: 3 2
  2737.     Command stack: +(1)
  2738.  
  2739.  4. The computer reads * (at parentheses-level 0) and pushes it to the command stack, since +(1) is of higher precedence (because of the higher level of parentheses) it is popped from the command stack and pushed to the RPN stack.
  2740.     RPN stack: 3 2 +
  2741.     Command stack: *(0)
  2742.  
  2743.  5. The computer reads 4 and pushes it to the RPN stack.
  2744.     RPN stack: 3 2 + 4
  2745.     Command stack: *(0)
  2746.  
  2747.  6. The computer reads +(1), since this is of higher level than *(0), *(0) remains at the command stack.
  2748.     RPN stack: 3 2 + 4
  2749.     Command stack: *(0) +(1)
  2750.  
  2751.  7. The computer reads 6, and pushes it to the RPN stack.
  2752.     RPN stack: 3 2 + 4 6
  2753.     Command stack: *(0) +(1)
  2754.  
  2755.  8. The computer reaches the end of the string, pops all entries from the command stack and pushes them to the RPN stack.
  2756.     RPN stack: 3 2 + 4 6 + *
  2757.     Command stack: 
  2758.  
  2759. And that's it!
  2760.  
  2761. 10.3. About reverse polish notation
  2762.  
  2763. Reverse Polish Notation (RPN) is a notation that makes it possible to write any mathematical expression without parentheses. (RPN is the native language of the programming language Forth.)
  2764.  
  2765. An expression in reverse polish notation might look something like this:
  2766.  
  2767.     3 2 + 4 6 + *
  2768.  
  2769. When an expression in reverse polish notation is evaluated any encountered numbers are pushed to a stack (that we might call the result stack). When a function is encountered it pops as many arguments as it needs from the result stack, performs whatever operation it should perform on this arguments and pushes the result back to the result stack.
  2770.  
  2771. If the example expression above was interpreted, this is what would happen:
  2772.  
  2773.  1. The computer reads 3, it is pushed to the result stack.
  2774.     Result stack: 3
  2775.  
  2776.  2. The computer reads 2, it is pushed to the result stack.
  2777.     Result stack: 3 2
  2778.  
  2779.  3. The computer reads +. This function needs two arguments, so it pops 2 and 3 from the stack, performs its operation (2 + 3). And pushes the result (5) to the stack.
  2780.     Result stack: 5
  2781.  
  2782.  4. The computer reads 4 and pushes it to the result stack.
  2783.     Result stack: 5 4
  2784.  
  2785.  5. The computer reads 6 and pushes it to the result stack.
  2786.     Result stack: 5 4 6
  2787.  
  2788.  6. The computer reads +. This functions needs two arguments so it pops 6 and 4 from the stack, performs its operation (4 + 6) and pushes the result (10) to the stack.
  2789.     Result stack: 5 10
  2790.  
  2791.  7. The computer reads *. 5 and 10 are popped from the stack and (5 * 10 = 50) is pushed to the stack.
  2792.     Result stack: 50
  2793.  
  2794. The final value of the result stack is the searched value. If you think of it, you will realise that 3 2 + 4 6 + * is in fact equal to (3 + 2) * (4 + 6) in ordinary notation.
  2795.  
  2796. The calculator will understand RPN if you use commas to delimit the separate entries, that is you may write (3 + 2) * (4 + 6) as 3, 2, +, 4, 6, +, *.
  2797.  
  2798. 11. Table of Content
  2799.  
  2800.   1. General Instructions
  2801.     1.1. About this program
  2802.     1.2. How to use it
  2803.     1.3. How to learn using the calculator
  2804.     1.4. General editing instructions
  2805.     1.5. Using multiple calculators
  2806.  
  2807.   2. The Menu Options
  2808.     2.1. The Apple menu
  2809.     2.2. The File menu
  2810.     2.3. The Edit menu
  2811.     2.4. The Calculator menu
  2812.     2.5. Calculator specific menus
  2813.  
  2814.   3. The Layman's Calculator
  2815.     3.1. The window
  2816.     3.2. Entering an expression
  2817.     3.3. Using the results of calculations
  2818.  
  2819.   4. The Scientific Calculator
  2820.     4.1. The window
  2821.     4.2. Using complex numbers
  2822.     4.3. Using variables
  2823.       4.3.1 Variables available
  2824.       4.3.2 Storing something in a variable
  2825.       4.3.3 Using a variable's value
  2826.     4.4. Doing multiple calculations
  2827.     4.5. Using reverse polish notation
  2828.  
  2829.   5. The Graph Drawer
  2830.     5.1. The window
  2831.     5.2. The Graph menu
  2832.     5.3. Ordinary graphs
  2833.     5.4. Polar graphs
  2834.     5.5. Parametric graphs
  2835.     5.6. Zooming and scrolling
  2836.     5.7. Finding intersections
  2837.     5.8. Numerical differentiation
  2838.     5.9. Numerical integration
  2839.  
  2840.   6. The Programmable Calculator
  2841.     6.1. The window
  2842.     6.2. The Programmable menu
  2843.     6.3. General editing instructions
  2844.     6.4. Programming vs. calculation
  2845.     6.5. Using variables
  2846.       6.5.1 Variables available
  2847.       6.5.2 Storing something in a variable
  2848.       6.5.3 Using a variable's value
  2849.     6.6. Controlling program flow
  2850.       6.6.1 The if - else - end construction
  2851.       6.6.2 The while-end construction
  2852.     6.7. Comparison of control functions
  2853.       6.7.1 goto
  2854.       6.7.2 gosub, functions
  2855.       6.7.3 else if
  2856.       6.7.4 switch, case
  2857.       6.7.5 for, next
  2858.     6.8. Getting data from the user
  2859.       6.8.1 Getting Data From Dialogs
  2860.       6.8.2 Getting Data From The Mouse
  2861.     6.9. Displaying data to the user
  2862.     6.10. Presenting data in dialogs
  2863.     6.11. Presenting data in a graphic window
  2864.     6.12. Sample programs
  2865.     6.12.1 Guessing game
  2866.     6.12.2 Mirror drawer
  2867.  
  2868.   7. Function Reference
  2869.     7.1. Function glossary
  2870.     7.2. Complex
  2871.     7.3. Dialogs
  2872.     7.4. Drawing
  2873.     7.5. Economic functions
  2874.     7.6. Exponential functions
  2875.     7.7. Integer
  2876.     7.8. Logical functions
  2877.     7.9. Memory functions
  2878.     7.10. Mouse functions
  2879.     7.11. Printing text and numbers
  2880.     7.12. Program flow
  2881.     7.13. Real-value
  2882.     7.14. Sign functions
  2883.     7.15. Time functions
  2884.     7.16. Trigonometric
  2885.     7.17. Window functions
  2886.  
  2887.   8. Formulas
  2888.     8.1. Mathematics
  2889.       8.1.1 Fundamental algebraic laws
  2890.       8.1.2 Approximations
  2891.       8.1.3 Algebra
  2892.         8.1.3.1 Quadratic laws, binomial theorem
  2893.         8.1.3.2 Solving Quadratic Equations
  2894.         8.1.3.3 Fundamental Theorem of Algebra
  2895.       8.1.4 Logarithms and Exponents
  2896.         8.1.4.1 Laws for Exponents
  2897.         8.1.4.2 Definition of Logarithms
  2898.         8.1.4.3 Logarithm Laws
  2899.       8.1.5 Analytical geometry
  2900.         8.1.5.1 Midpoints
  2901.         8.1.5.2 Distances
  2902.         8.1.5.3 Scalar Product
  2903.         8.1.5.4 Vector length
  2904.         8.1.5.5 Angle between vectors
  2905.         8.1.5.6 Straight Lines
  2906.       8.1.6 Calculus
  2907.         8.1.6.1 Increasing/Decreasing Functions
  2908.         8.1.6.2 Local maximum and minimum
  2909.         8.1.6.3 Derivative of Function
  2910.         8.1.6.4 Finding Maximum and Minimum
  2911.         8.1.6.5 Determining concavity
  2912.         8.1.6.6 Mean Value Theorem
  2913.       8.1.7 Rules of Differentiation
  2914.         8.1.7.1 Arithmetic Operations
  2915.         8.1.7.2 Common derivatives
  2916.       8.1.8 Integrals
  2917.         8.1.8.1 Primitive functions
  2918.         8.1.8.2 Rules of Integration
  2919.         8.1.8.3 Common Integration Methods
  2920.         8.1.8.4 Some primitive functions
  2921.       8.1.9 Conics
  2922.       8.1.10 Differential equations
  2923.         8.1.10.1 First order
  2924.         8.1.10.2 Second order
  2925.       8.1.11 Geometry
  2926.         8.1.11.1 Parallelogram 
  2927.         8.1.11.2 Parallel trapezium
  2928.         8.1.11.3 Circle
  2929.         8.1.11.4 Circle sector
  2930.         8.1.11.5 Prism
  2931.         8.1.11.6 Pyramid
  2932.         8.1.11.7 Straight circular cylinder
  2933.         8.1.11.8 Straight circular cone
  2934.         8.1.11.9 Sphere
  2935.       8.1.12 Trigonometry
  2936.         8.1.12.1 Pythagora's theorem
  2937.         8.1.12.2 Definitions
  2938.         8.1.12.3 The Triangle
  2939.         8.1.12.4 Trigonometric Identities
  2940.       8.1.13 Sequences and series
  2941.         8.1.13.1 Arithmetic sequence
  2942.         8.1.13.2 Geometric sequence
  2943.         8.1.13.3 Convergence
  2944.       8.1.14 Statistics
  2945.         8.1.14.1 Concepts
  2946.         8.1.14.2 Mean, median, mode
  2947.         8.1.14.3 Standard deviation
  2948.       8.1.15 Probability
  2949.         8.1.15.1 Basic Concepts
  2950.         8.1.15.2 Binomial distribution
  2951.         8.1.15.3 The common frequency function
  2952.         8.1.15.4 Interval of confidence
  2953.     8.2. Physics
  2954.       8.2.1 Physical constants
  2955.       8.2.2 Mechanics
  2956.         8.2.2.1 Density
  2957.         8.2.2.2 Pressure
  2958.         8.2.2.3 Velocity, acceleration
  2959.         8.2.2.4 Movement with constant acceleration
  2960.         8.2.2.5 Newton's second law of motion
  2961.         8.2.2.6 Moment
  2962.         8.2.2.7 Newton's law of gravitation
  2963.         8.2.2.8 Friction
  2964.         8.2.2.9 Throwing parabola
  2965.         8.2.2.10 Momentum
  2966.         8.2.2.11 Centripetal force
  2967.         8.2.2.12 Harmonic motion
  2968.         8.2.2.13 Work, energy
  2969.         8.2.2.14 Power
  2970.         8.2.2.15 Straight central collision
  2971.         8.2.2.16 Hookes' law
  2972.       8.2.3 Proprieties of gases
  2973.         8.2.3.1 Boyle's law
  2974.         8.2.3.2 Charles' law
  2975.         8.2.3.3 Gay-Lussac's law
  2976.         8.2.3.4 General gas law
  2977.         8.2.3.5 Volume expansion of a gas at constant pressure
  2978.         8.2.3.6 Dalton's law
  2979.         8.2.3.7 Kinetic gas theory
  2980.       8.2.4 Theory of heat
  2981.       8.2.5 Electronics I - Electrostatics, direct current
  2982.         8.2.5.1 Coulomb's law
  2983.         8.2.5.2 Charge
  2984.         8.2.5.3 Voltage
  2985.         8.2.5.4 Electric Field Force
  2986.         8.2.5.5 Capacitance
  2987.         8.2.5.6 Resistance
  2988.         8.2.5.7 Electrolytic battery
  2989.         8.2.5.8 Power and energy
  2990.       8.2.6 Electronics II Magnetism
  2991.         8.2.6.1 Magnetic flux density
  2992.         8.2.6.2 Laplace's formula
  2993.         8.2.6.3 Magnetic flux
  2994.         8.2.6.4 Force between magnetic fields and charges in motion
  2995.         8.2.6.5 Electromagnetic induction
  2996.       8.2.7 Electronics III. Alternating current.
  2997.         8.2.7.1 Basics
  2998.         8.2.7.2 Impedance and phase lag
  2999.         8.2.7.3 Resonance
  3000.         8.2.7.4 Power
  3001.         8.2.7.5 Transformer
  3002.         8.2.7.6 Electronic oscillator
  3003.       8.2.8 Optics
  3004.         8.2.8.1 Photometrics
  3005.         8.2.8.2 Spherical mirrors
  3006.         8.2.8.3 Law of refraction
  3007.         8.2.8.4 Index of refraction
  3008.         8.2.8.5 Minimum deviation in prism
  3009.         8.2.8.6 Thin lenses
  3010.       8.2.9 Wave theory
  3011.         8.2.9.1 Basics
  3012.         8.2.9.2 Doppler effect
  3013.         8.2.9.3 Speed of sound
  3014.       8.2.10 Electromagnetic radiation
  3015.         8.2.10.1 Stefan-Boltzmann's law
  3016.         8.2.10.2 Wien's displacement law
  3017.         8.2.10.3 Diffraction grating
  3018.       8.2.11 Nuclear physics
  3019.         8.2.11.1 Planck's law
  3020.         8.2.11.2 Photoelectric effect
  3021.         8.2.11.3 de Broglie's formula
  3022.         8.2.11.4 Radioactive decay
  3023.         8.2.11.5 Theory of relativity
  3024.     8.3. Chemistry
  3025.       8.3.1 Chemical equilibrium
  3026.       8.3.2 Acids and bases
  3027.     8.4. Economics
  3028.       8.4.1 Interest
  3029.  
  3030.   9. Error Codes
  3031.     9.1. Acsc value not defined
  3032.     9.2. Arccosine argument not between -1 and 1
  3033.     9.3. Arcsine argument not between -1 and 1
  3034.     9.4. Asec value not defined
  3035.     9.5. Cot value not defined
  3036.     9.6. Csc value not defined
  3037.     9.7. Division by complex zero
  3038.     9.8. Division by zero
  3039.     9.9. Else without if
  3040.     9.10. End without while or if
  3041.     9.11. Expression too complex
  3042.     9.12. Function lacking arguments
  3043.     9.13. Function name too long
  3044.     9.14. Function nesting too complex
  3045.     9.15. Interrupted by user
  3046.     9.16. Invalid arithmetic sum
  3047.     9.17. Invalid geometric sum
  3048.     9.18. Modulo zero
  3049.     9.19. Number or text used where variable is required
  3050.     9.20. Passing non-text arguments to a function which requires text arguments
  3051.     9.21. Program too long
  3052.     9.22. Raising negative number to fraction exponents
  3053.     9.23. Raising zero to negative exponent
  3054.     9.24. Sec value not defined
  3055.     9.25. Trying to calculate logarithm of negative value or zero
  3056.     9.26. Trying to invert zero
  3057.     9.27. Trying to permute negative value
  3058.     9.28. Trying to read beyond memory
  3059.     9.29. Trying to take root of negative value
  3060.     9.30. Trying to take tangent of odd multiple of ╣/2
  3061.     9.31. Trying to use 1, 0 or a negative number as base for a logarithm
  3062.     9.32. Unknown character used
  3063.     9.33. Unknown character combination used
  3064.     9.34. Unknown function used
  3065.     9.35. Unrecognized function
  3066.     9.36. Value returned by sinh too large
  3067.     9.37. Value returned by cosh too large
  3068.  
  3069.   10. Technical Information
  3070.     10.1. How the calculator works
  3071.     10.2. Text to reverse polish notation
  3072.     10.3. About reverse polish notation
  3073.